3

I have the following configuration in my apache2.conf

<VirtualHost *:80>
   ServerAdmin webmaster@Host-Wordpress-01
   DocumentRoot /var/www/wordpress_example
   Servername www.example.com
   ServerAlias example.com
 </VirtualHost>

All I want is to change it so it's not accessible by an IP address anymore (i.e., the server's IP address) and only by www.example.com

What would I change?

1

1 Answer 1

2

The solution would be the same as for Block a random domain pointing at my dedicated IP. I posted an answer there with configuration and a script.

Basically, you need to create a default virtual host entry to handle the IP address and any other random addresses. Then you can have your real site in a second virtual host directive that is specific to your site.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.