0

I have a CentOS LAMP server. It has several vhosts configured. If I navigate to:

http://xxx.xxx.xxx.xxx/  (server IP)

Apache displays one of the sites. How can I configure Apache to show nothing or perhaps a 403 Forbidden? If it could show a forbidden before checking for malformed requests that would be even better.

1 Answer 1

4

The first vhost that Apache picks up from your configuration is the default one picked when the name that the client sends doesn't match any configured vhost, so you'll have to make a vhost that sends 403 errors and ensure that it's picked up first in the httpd config.

3
  • Will this show the 403 even if it's a malformed request where a 400 would normally be served? Also what's the syntax in the vhost directive to issue the 403? Mar 30, 2012 at 19:23
  • 1
    Order Allow,Deny, Deny from all. Put it in a <Location /> block in the default (first) vhost. Mar 30, 2012 at 19:51
  • Thanks, the 403 can also be done by removing the DocumentRoot in the first vhost. Apr 2, 2012 at 8:30

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .