Depending on the WebService you are using the answer varies. If you are using Apache as a WebService you can use the following way:
Additionally, this mini tutorial will be for Ubuntu. If you are using CentOS let me know and I’ll provide steps for it as well :
You’ll need to create a virtual configuration - Vhost.
Create a new config file in the sites-available directory:
sudo nano /etc/apache2/sites-available/direct.conf
In the file add the following :
You’ll need to change the xxx.xxx.xxx.xxx with your actual IP address and the /path/to/file with the path to the file being the file you wish people to see when they access the IP address. Once you have saved the file, type
sudo a2ensite direct
and restart your server:
sudo apache2 restart
That’s it, you’ve now redirected access of your IP address to a certain file.
If you wish to completly deny it, add the DocumentRoot to be /dev/null
You can add this server block to your configuration.
listen 80 default_server;
You need to specify “defaultserver” parameter so that all non available server requests goes to this server block which throws 444 error. The “defaultserver” parameter cannot be present in any other server block.
444 : CONNECTION CLOSED WITHOUT RESPONSE