If you want to disable access to your website or domain through the IP address of your server then you can follow the steps below.
Log in to your server using putty (SSH).
After that you need to access httpd.conf file. The location of httpd.conf may vary. In this case – VestaCP is installed on Centos server and the location is- /home/admin/conf/web/
Use the following command to go into the directory which contains httpd.conf file
Note: If the username is something other than admin then replace admin with the appropriate username.
After this to edit httpd.conf file use the command given below
Now you can edit the file using vi editor, below is an example of httpd.conf file
Add the code at the beginning of the file everything else remains the same. Below is the code.
<VirtualHost 188.8.131.52:8080> ServerName 184.108.40.206 Redirect 403 / ErrorDocument 403 "No" DocumentRoot /dev/null/ </VirtualHost>
Note: Replace 220.127.116.11 with your server IP address.
Save changes and then restart httpd using the below command.
service httpd restart
Now if any one types in your server’s IP address then rror will be shown and your website will not be accessible using the IP address of the server.