This is the first time I actually try to setup a server myself.
Everything is working good so far. I have added a new virtual server and changed my domainĀ“s A records and it is now working as expected.
However: I would like to "block" access to the default www dir (in my case var/www
). Right now when I enter the server IP instead of the domain, I get to the default www dir – I would like to disable that.
I dont want to setup a redirect, but simply forbid users, search engines etc. to view anything when they go to http://myip/
Currently I am doing the trick with adding an empty index.html
, but I would like to actually block all requests and only allow access to my domains (they are in a subdir like "var/www/sites/domain.com/www
")
I hope you get what I mean – my english sucks :/
p.s. since I installed webmin and I access it through http://myIp:webminPort
– I think I actually only want to block port 80, but not sure about that…
Best Answer
You need to keep port 80 open as all your content for the domain.com/www vhost travels through 80 as well.
There is a default vhost setup by apache, you just need to comment it out in your httpd.conf.
To edit the config in webmin:
Give it a slow read through and you'll find the default vhost code block, just comment it out. This is worth it as you may want to tune settings later anyways.
Andre(OP) determined the default vhost definition was in /sites-enabled/default-000
Here is the section you are looking for:
Comment out these Directives within Section 2 using a hash: