atom feed4 messages in ru.sysoev.nginxRE: '403 Forbidden' error after insta...
FromSent OnAttachments
Stefan ScottNov 28, 2008 1:30 am 
Stefan ScottNov 28, 2008 1:42 am 
Jim OhlsteinNov 28, 2008 7:52 am 
Stefan ScottNov 28, 2008 2:23 pm 
Subject:RE: '403 Forbidden' error after installing nginx
From:Jim Ohlstein (jim.@gmail.com)
Date:Nov 28, 2008 7:52:54 am
List:ru.sysoev.nginx

What are the permissions for /usr/local/nginx ?

-----Original Message----- From: owne@sysoev.ru [mailto:owne@sysoev.ru] On Behalf Of Stefan
Scott Sent: Friday, November 28, 2008 4:31 AM To: ngi@sysoev.ru Subject: '403 Forbidden' error after installing nginx

Hello -

Yesterday everything worked fine when I installed nginx 0.6.33 at one VPS (virtual private server) web hosting provider (xencon.net) using Debian Etch. Today I installed nginx 0.6.34 (slightly newer) at a different VPS web hosting provider also using Debian Etch (gandi.net), and when I point my browser to the site at the second provider I'm getting the error '403 Forbidden'.

Here is what the last line in file error.log in directory /usr/local/nginx/logs/ says at the second provider:

2008/11/28 09:50:01 [error] 9156#0: *1 "/usr/local/nginx/html/index.html" is forbidden (13: Permission denied), client: 111.222.333.444, server: localhost, request: "GET / HTTP/1.1", host: "mydomain.com"

In both cases, I was following the steps outlined here:

http://articles.slicehost.com/2007/10/19/debian-etch-installing-nginx http://articles.slicehost.com/2007/10/19/debian-etch-adding-an-nginx-init-script

Well - there's two things that changed from yesterday to today: different release, and different VPS web hosting provider.

To test if if was due to the different release, I tried deleting everything I could find from the install at the second provider (per the instructions in the first link above, the install on Debian Etch had been done manually, because the nginx package included with Debian Etch is outdated) - ie I deleted the ~/sources directory and the /usr/local/nginx directory and then installed version 0.6.33 this time instead of 0.6.34 - but the '403' error at the second provider continued to occur.

Maybe there's something different between these two providers. Doing 'ls -l' on the files in /usr/local/nginx, I did see that the 'read' permission is always YES at the first VPS provider, and always NO at the second VPS provider:

FIRST HOSTING PROVIDER /usr/local/nginx/html: -rw-r--r-- 1 root staff 383 2008-11-26 20:59 50x.html -rw-r--r-- 1 root staff 151 2008-11-26 20:59 index.html

SECOND HOSTING PROVIDER /usr/local/nginx/html: -rw-r----- 1 root staff 383 2008-11-28 07:42 50x.html -rw-r----- 1 root staff 151 2008-11-28 07:42 index.html

So I used the command 'chmod a+x -R' to allow read access on all these files and directories, but the error still occurs.

When I google 'nginx 403 forbidden' I see that this error has also occurred for some other people (but usually in more complicated situations involving nginx as a reverse proxy with mongrels upstream), and people have tried either allowing read access (which never helped), or changing the file owner (which did help in some cases, where reverse proxying and mongrels were involved):

http://nicholasorr.com/blog/2008/07/22/nginx-engine-x-what-a-pain-in-the-bum/ http://www.ruby-forum.com/topic/147003

In my case, this is just a "hello, world" situation, where I'm installing nginx to see if I can connect from my browser, and I can't quite understand what the file owner permissions have to do with it, so I'm unsure what I should do.

Any suggestions would be greatly appreciated!

Thanks.