Page 1 of 2 12 LastLast
Results 1 to 10 of 13

Thread: Nginx: Permission denied

  1. #1

    Default 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.

    /var/log/nginx/error.log
    Code:
    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
    Code:
    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: http://susepaste.org/75269286
    This problem is driving me nuts, does anybody have an idea what's wrong?

  2. #2
    Join Date
    Jun 2008
    Location
    Netherlands
    Posts
    29,742

    Default Re: Nginx: Permission denied

    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.
    Henk van Velden

  3. #3
    Join Date
    Jan 2013
    Location
    Germany
    Posts
    289

    Default Re: Nginx: Permission denied

    Is the port 80 open?
    Code:
    nmap -O -sV 127.0.0.1

  4. #4
    Join Date
    Jun 2008
    Location
    San Diego, Ca, USA
    Posts
    13,295
    Blog Entries
    2

    Default Re: Nginx: Permission denied


    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.

    spiollinux
    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.

    HTH,
    TSU

  5. #5
    Join Date
    Jan 2013
    Location
    Germany
    Posts
    289

    Default Re: Nginx: Permission denied

    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.

  6. #6

    Default Re: Nginx: Permission denied

    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.

  7. #7
    Join Date
    Jun 2008
    Location
    San Diego, Ca, USA
    Posts
    13,295
    Blog Entries
    2

    Default Re: Nginx: Permission denied

    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?

    TSU

  8. #8
    Join Date
    Jun 2008
    Location
    San Diego, Ca, USA
    Posts
    13,295
    Blog Entries
    2

    Default Re: Nginx: Permission denied

    Quote Originally Posted by spiollinux View Post
    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.
    Cool. That could do it.

    TSU

  9. #9

    Default Re: Nginx: Permission denied

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

  10. #10
    Join Date
    Jun 2008
    Location
    Netherlands
    Posts
    29,742

    Default Re: Nginx: Permission denied

    Quote Originally Posted by spiollinux View Post
    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.
    As I urged you to do in post #2 above 10 hours ago
    Henk van Velden

Page 1 of 2 12 LastLast

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •