nginx prompts 403 when starting access
習慣沉默
習慣沉默 2017-05-16 17:12:19
0
3
497

After installing nginx, I set the owner of sbin/nginx to root and suid permissions to monitor port 80.

chown root sbin/nginx chmod u+s sbin/nginx

But after startup, when accessing localhost port 80, an error is reported: 403 Forbidden

nginx related configuration file contents are as follows:

server { listen 80; server_name localhost; #charset koi8-r; charset utf-8; #access_log logs/host.access.log main; location / { root html; index index.html index.htm; } #error_page 404 /404.html; # redirect server error pages to the static page /50x.html # error_page 500 502 503 504 /50x.html; location = /50x.html { root html; }

The error log information is:

[error] 4633#0: *1 open() "nginx/html/favicon.ico" failed (13: Permission denied), client: 127.0.0.1, server: localhost, request: "GET /favicon.ico HTTP/1.1", host: "localhost", referrer: "http://localhost/"

The permissions of the html directory are as follows, and there is a corresponding index file in this directory

drwxrwxrwx@ 4 xxxxx staff 136 Nov 16 21:16 html

Excuse me, what is the problem? Baidu later said it was a permissions issue, but I can’t fix it no matter how I change it?
My system is mac.

習慣沉默
習慣沉默

reply all (3)
小葫芦

What are the permissions of your index.html file? It may be that you have not given permissions to the files in the folder.

    我想大声告诉你

    Add user root to the header of the nginx configuration file; try it, if it doesn’t work, check what the user and group are for the files in your html directory? Then try changing the startup user to the user to which the directory belongs.

      大家讲道理

      Try turning off the firewall first.
      If it doesn’t work, turn off the SELinux service as well

        Latest Downloads
        More>
        Web Effects
        Website Source Code
        Website Materials
        Front End Template
        About us Disclaimer Sitemap
        php.cn:Public welfare online PHP training,Help PHP learners grow quickly!