I think I understand what you are getting at: if you just type in the IP address of the server its points to the DocumentRoot of a clients domain and not the default web DocumentRoot directory of example.com. I had the same problem, it would point to the first domain in my DNS list. The way i fixed this was to create a new default virtual host record.
You need to relise that HOSTNAME and DOMAIN NAME are 2 different things. Even though hostname can be/is a fully qualified domain name, unless you setup a site for it there will not be one. You need to go to SITES/WEBSITES/ADD NEW SITE and create new site for example.com . So if someone puts in your servers IP address it will default to the first domain record (for me it was the first domain is DNS list) that is loaded (in apache anyways)
I use Apache, so not sure about nginx (but someone should be able to tell you want to do for nginx), but what i did for apache was:
create a new default /etc/httpd/conf/sites-available/_default.vhost file, then added the following code at the top:
Code:
<VirtualHost _default_:80>
ServerName example.com
ServerAdmin webmaster@example.com
DocumentRoot /var/www/example.com/web
</VirtualHost>
OR
Code:
<VirtualHost 123.456.678.9:80>
ServerName example.com
ServerAdmin webmaster@example.com
DocumentRoot /var/www/example.com/web
</VirtualHost>
You can change the DocumentRoot to point to wherever you want.
Then i created a symbolic link to the file /etc/httpd/conf/sites-enabled/000-default.vhost
Code:
ln -s /etc/httpd/conf/sites-available/_default.vhost /etc/httpd/conf/sites-enabled/000-default.vhost
This will catch all http requests to the IP address.
Recent comments
2 days 22 hours ago
3 days 6 hours ago
3 days 9 hours ago
3 days 10 hours ago
3 days 12 hours ago
3 days 14 hours ago
3 days 15 hours ago
3 days 16 hours ago
4 days 8 hours ago
4 days 9 hours ago