
: Deny access from the server's IP address and allow www.example.com using Apache configuration I have the following configuration in my apache2.conf <VirtualHost *:80> ServerAdmin webmaster@Host-Wordpress-01
I have the following configuration in my apache2.conf
<VirtualHost *:80>
ServerAdmin webmaster@Host-Wordpress-01
DocumentRoot /var/www/wordpress_example
Servername 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 example.com
What would I change?
More posts by @Hamm4606531
1 Comments
Sorted by latest first Latest Oldest Best
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.
Terms of Use Create Support ticket Your support tickets Stock Market News! © vmapp.org2025 All Rights reserved.