Nginx: Permission denied

Since a while nginx 1.4.4 refuses to deliver webpages and always returns “403 Forbidden”. I can’t remember having changed anything before this problem occured, nevertheless I deleted /etc/nginx an reinstalled it. It’s still not working.


2014/03/02 22:46:14 [error] 3674#0: *16 "/srv/www/htdocs/index.html" is forbidden (13: Permission denied), client: xx.xx.xx.xx, server: localhost, request: "GET / HTTP/1.1", host: "xx.xx.xx.xx"

I set the permissions on /srv/www/htdocs to 777 for testing purposes, didn’t help

ls -l /srv/www/htdocs
insgesamt 8
-rwxrwxrwx 1 nginx nginx 537 20. Nov 18:05 50x.html
-rwxrwxrwx 1 nginx nginx  91  2. Mär 22:33 index.html

As I’ve deleted /etc/nginx before reinstallin I’m using the default config, here it is:
This problem is driving me nuts, does anybody have an idea what’s wrong?

You could at least start telling us which version of openSUSE you use.

I can not say anything about nginx (not using it, in fact never heard of it until now, most people will use Apacha I guess), but while you talk about checking permission, it is not only the ownership/permission of the file /srv/www/htdocs/index.html, but also those of /srv, /srv/www and /srv/www/htdocs that matter. You do not show them, thus I do not know if you checked if the user nginx has serach/read access through the directories in that path.

Is the port 80 open?

nmap -O -sV

nginx is all the rage now.
Very light on memory requirements, very powerful.
And, most of all very versatile. Out of the box, is generally easy to re-configure either as a regular webserver or as a proxy (in particular reverse proxy). Is why it has become a favorite for Production use and NetAdmins.

In a default openSUSE install nginx runs in the context of root, so your web root shouldn’t be owned by nginx/nginx, it should be owned by root/root. On the other hand of course, if you modified accordingly it certainly seems much better to run as a lower privileged User, but if/whenever you update/upgrade YMMV depending on how you modified.


He has given full access for all (777) and it didn’t help. The problem isn’t the access right then.
I want to see, whether there would be a problem with the firewall.

While focusing on the permissions of htdocs I completely forgot about the parent folders. I guess there was a x permission missing because after a chmod ug+rw on /srv and /srv/www the problem is gone.
Thanks for all your effort.

I just ran some tests with nginx.

I found that there shouldn’t have been a permissions issue regardless whether the files were owned by root or nginx, and it also didn’t matter if the file permissions are altered to permit “everyone” (0777). I was able to serve pages successfully in every configuration.

I also tested with the firewall up or down (blocking) and I got a different error message.

So, if the error message as stated is correct, then the problem is somewhere else…

That leads me to ask where this nginx was installed from… Did it come from the openSUSE repos (as it should) or was it installed from some other source?


Cool. That could do it.


One last thing: How can I mark this thread as solved?

As I urged you to do in post #2 above 10 hours ago rotfl!

By telling what the solution is (as you did) for the benifit of others.

And of course by adding the still missing information: What Version of openSUSE???

openSUSE 13.1 with nginx 1.4.4 from the main repo

That can generally be done by simply modifying the subject line in your reply.
But, unlike other forums people don’t usually take the time to do so.

I’ll go ahead and change this thread’s subject line with this post for you.