Mobile app version of vmapp.org
Login or Join
Hamm4606531

: 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

@Hamm4606531

Posted in: #Apache2 #Configuration

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?

10.01% popularity Vote Up Vote Down


Login to follow query

More posts by @Hamm4606531

1 Comments

Sorted by latest first Latest Oldest Best

 

@BetL925

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.

10% popularity Vote Up Vote Down


Back to top | Use Dark Theme