2
禁止nginx的我已經閱讀beginner's guide of nginx:403在Ubuntu
server {
location/{
root /data/www;
}
location /images/ {
root /data;
}
}
http://localhost/images/example.png - > /data/images/example.png
http://localhost/some/example.html - > /data/www/some/example.html
所以我的nginx的配置:
server {
listen 443;
server_name localhost;
ssl on;
ssl_certificate /home/attolee/sslkey/example.crt;
ssl_certificate_key /home/attolee/sslkey/example.key;
ssl_session_timeout 5m;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_ciphers ALL:!ADH:!EXPORT56:-RC4+RSA:+HIGH:+MEDIUM:!EXP;
ssl_prefer_server_ciphers on;
location/{
root /home/attolee;
index index.html;
}
location /hi/ {
root /home/attolee;
index hi.html;
}
}
我想
次- https://host/訪問/home/attolee/index.html,
- https://host/hi/訪問/home/attolee/hi/hi.html,
現在1個工作,2失敗,403禁止。
錯誤日誌告訴我是13: Permission denied
。
因此,我檢查自己和/ home/attolee和/ home/attolee/hi /以及hi.html組。
drwxr-xr-x 6 attolee attolee 4096 Nov 2 17:08 attolee/
drw-rw-rw- 2 root root 4096 Nov 2 17:12 hi/
-rw-rw-rw- 1 root root 24 Nov 2 17:12 hi.html
然後檢查nginx進程使用htop的USER屬性是root。
如何解決這個問題?
目錄需要'x'權限 –
@AlexeyTen用''x''更改''other''權限,它可以工作。 – attolee