I have an odd problem when attempting to browse to pages stored on a local web server (Apache 2.2). The pages are served as expected when I browse to localhost or on port 80. Yet when I attempt to browse to the same pages by referencing the local IP address (192.168.x.x), I receive a HTTP 403 (Forbidden) error. In essence, http://localhost:80 works but 192.168.x.x:80 doesn't even though I'm specifying the IP of the local machine. You may be thinking "who cares? just use localhost". However, this is the first step in troubleshooting why I cannot remotely access these pages from different hosts on my LAN.

I'm presuming this can't be a firewall issue as I'm only connecting to the local machine. Even so, I verified there was no iptables rules that could be having an effect.

I've checked the Apache error logs and the corresponding line of relevance is:

[Sat Oct 19 07:38:35 2013] [error] [client 192.168.x.x] client denied by server configuration: /var/www/

I've inspected most of the apache config files and they don't appear to differ from what you would expect with a default install. I can't see anything in apache2.conf that would be a problem and httpd.conf is an empty file. This is an excerpt from /etc/apache2/sites-enabled/000-default:

<VirtualHost *:80>
    ServerAdmin webmaster@localhost

    DocumentRoot /var/www
    <Directory />
            Options FollowSymLinks
            AllowOverride None
    <Directory /var/www/>
            Options Indexes FollowSymLinks MultiViews
            AllowOverride All
            Order allow,deny
            allow from all

Any insight as to where I can look next to find a solution ?

Thanks in advance.

  • What is the contents of .htaccess in the /var/www/ folder? – Barry Carlyon Oct 19 '13 at 13:36
  • @BarryCarlyon Thanks, that was it. .htaccess files were not configured as expected. Feel free to post your comment an answer so I can accept it. – amjo324 Oct 19 '13 at 22:05

As requested.

The next thing to check since your httpd.conf/vhost is correct, is the .htaccess file found in the directory in question.

Httpd.conf/vhost is applied first and subsequently overruled by .htaccess in the requested folder (as permitted by the httpd.conf/vhost in the first place). So my theory is that a rule in there is causing the permission error.

| improve this answer | |

As per your description I am assuming you are using Apache a Debian based system. I think httpd is not listening on you 192.168.x.x IP address. It is listening only on localhost. You can verify it using following command.

netstat -tulpn | grep :80

I think you will see in the output. If yes, then check /etc/apache2/ports.conf file. You should use Listen 80 in the file to ask httpd to listen on all IP addresses. Refer following links.

http://httpd.apache.org/docs/2.2/bind.html http://httpd.apache.org/docs/2.2/mod/mpm_common.html#listen

| improve this answer | |
  • Thanks for your input. I'd already checked my ports.conf file and it specified Listen 80. Also, httpd was listening on the 'catch all address' of Turns out it was .htaccess files that were the problem as per Barry's suggestion. – amjo324 Oct 19 '13 at 21:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.