Nginx: stat() failed (13: permission denied)

后端 未结 16 1838
梦谈多话
梦谈多话 2020-12-04 05:04

I am using the default config while adding the specific directory with nginx installed on my ubuntu 12.04 machine.

server {
        #listen   80; ## listen          


        
相关标签:
16条回答
  • 2020-12-04 05:56

    I found a work around: Moved the folder to nginx configuration folder, in my case "/etc/nginx/my-web-app". And then changed the permissions to root user "sudo chown -R root:root "my-web-app".

    0 讨论(0)
  • 2020-12-04 05:58

    You can also add which user will run the nginx. In the nginx.conf file, make the following changes:

    user root;
    

    You can add the above line as the first line in your nginx conf. You can write the name of any user who has the permission to write in that directory.

    0 讨论(0)
  • 2020-12-04 05:59

    Change your nginx.conf user property to www-static files owener.

    #   * Official English Documentation: http://nginx.org/en/docs/
    #   * Official Russian Documentation: http://nginx.org/ru/docs/
    
    user your_user_name;
    
    # same other config
    
    0 讨论(0)
  • 2020-12-04 06:00

    On CentOS 7.0 I had this Access Deined problem caused by SELinux and these steps resolved the issue:

    yum install -y policycoreutils-devel
    grep nginx /var/log/audit/audit.log | audit2allow -M nginx
    semodule -i nginx.pp
    

    Update: Just a side-note from what I've learned while using digitalocean's virtual Linux servers, or as they call them Droplets. Using SELinux requires a decent amount of RAM. It's most probably like you won't be able to run and manage SELinux on a droplet with less than 2GB of RAM.

    0 讨论(0)
提交回复
热议问题