Prevent Access to server when URL is an IP address

Jayson Wonder

Verified User
Joined
May 27, 2015
Messages
22
Hello,

I have a VPS with 2 IP addresses hosting various sites. These sites / domains share the 2 IP's. When I type in the IP address as a URL it takes me to the following pages...

First IP shows:
"Apache is functioning normally"

Second IP shows:
"This IP is being shared among many domains.
To view the domain you are looking for, simply enter the domain name in the location bar of your web browser."

I do not want these to be visible and would like to have it redirect to a 403 Forbidden or similar capable of blocking access when either IP address is entered.

Any suggestions on the best way to do this?

Thanks,
 
The first notice is displayed in /var/www/html/index.html you could change or remove the text in there.
I don't know here the second one is configured.
 
Hi,
You could edit these files :
for first one :
/var/www/html/index.html
for 2nd one :
/domains/sharedip/index.html

Regards.
Good point and it gave me an idea, why not just restrict the access using permissions on the file. Sounds easy but of course it opened up a new cans of worms.

This page:
/var/www/html/index.html
Is normal and a simple chmod 600 solved that issue. Well it at least gives me an 403 Forbidden page, sweet but it also adds this error too: "Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request." This is not drastic but concerning since I am not sure what the problem is and want to fix it (searching now)......any thoughts please chime in ;)

This one:
/domains/sharedip/index.html
It is actually in /home/myreseller/domains/sharedip/index.html & in /home/admin/domains/sharedip/index.html. The first location is the bothersome index.html that has been frustrating me. A quick chmod 600 did it for this too. The second one is clearly the admin account and there is no site associate with that account but I did that also, hope I don't break anything lol.

I am reading and looking into a more graceful approach using error handling preferably but my attempts are not working yet. I assume it is related to my can of worms above.

Anyway thanks so much for your suggestions.
 
I really don't recommend doing this changes.
Those pages are there for a reason.
If you receive a 403 or 404 for everything, troubleshooting will become a nightmare.

Good luck
 
Back
Top