入门客AI创业平台(我带你入门,你带我飞行)
博文笔记

nginx favicon.ico 出现403 forbidden

创建时间:2015-10-23 投稿人: 浏览次数:2785

为了允许favicon.ico可以转发,配置如下:

location ~ (favicon.ico) {
        root html;
}

root html把项目的目录指向到/usr/local/nginx/html

因为nginx的worker线程是以nobody用户运行的,而/usr/local/nginx/html下面文件的访问权限为:

MacBook-Pro:~ yangyamin$ ls -la /usr/local/nginx/html/
total 144
drwxr-xr-x@  5 root  wheel    170 10 22 21:28 .
drwxr-xr-x  27 root  wheel    918 10 23 14:00 ..
-rw-r--r--@  1 root  wheel    537 10 22 15:48 50x.html
-rw-r-----   1 root  wheel  62134 10 22 21:28 favicon.ico
-rw-r--r--@  1 root  wheel    612 10 22 15:48 index.html

发现favicon.ico文件没有授予other 读权限

sudo chmod a+r /usr/local/nginx/html/favicon.ico
把/usr/lo

其他思路

[未验证] 可以把nginx.conf中的user项设置为:

user  root;
声明:该文观点仅代表作者本人,入门客AI创业平台信息发布平台仅提供信息存储空间服务,如有疑问请联系rumenke@qq.com。
  • 上一篇:没有了
  • 下一篇:没有了
未上传头像