mac nginx 静态资源 403

nginx 静态资源 403

修改为有权限的用户

user nobody;

user user_00 users;

重启 nginx 即可

user 文档

user 用户  用户组;

静态 css 资源输出的 Content-Type 错误

Content-Type: text/html; charset=UTF-8
  1. 由于静态 css 资源的访问权限不足,导致其无法访问。
  2. 规则配置中,对于不存在的资源,请求将被转发到 index.php,所以输出的内容都是 php 的动态处理内容

跟踪 nginx 进程

  1. 将 nginx 的配置调整为 1 个 worker
  2. ps -ef | grep nginx 查看到 worker 对应的进程ID
  3. 跟踪进程ID,并发起异常请求,查看屏幕输出
$ sudo dtruss -p 8888
SYSCALL(args)        = return
access("/etc/localtime\0", 0x4, 0x0)         = 0 0
open_nocancel("/etc/localtime\0", 0x0, 0x0)      = 3 0
fstat64(0x3, 0x7FFEE3BFCFF8, 0x0)        = 0 0
read_nocancel(0x3, "TZif2\0", 0xA1E8)        = 528 0
close_nocancel(0x3)      = 0 0
issetugid(0x0, 0x0, 0x0)         = 1 0
open_nocancel("/var/db/timezone/zoneinfo/posixrules\0", 0x0, 0x0)        = 3 0
fstat64(0x3, 0x7FFEE3BFCE48, 0x0)        = 0 0
read_nocancel(0x3, "TZif2\0", 0xA1E8)        = 3519 0
close_nocancel(0x3)      = 0 0
accept(0x6, 0x7FFEE3BFD580, 0x7FFEE3BFD57C)      = 3 0
kevent(0xC, 0x7FAF2E02B200, 0x1)         = 2 0
accept(0x6, 0x7FFEE3BFD580, 0x7FFEE3BFD57C)      = 4 0
recvfrom(0x3, 0x7FAF2F001000, 0x400)         = 690 0
open("/data/services/localhost/web/test.html\0", 0x4, 0x0)       = -1 Err#13
write(0x9, "2018/11/07 17:04:19 [error] 8576#0: *611 open() \"/data/services/localhost/web/test.html\" failed (13: Permission denied), client: 127.0.0.1, server: localhost, request: \"GET /test.html HTTP/1.1\", host: \"localhost\"\n\0", 0xD5)       = 213 0
writev(0x3, 0x7FFEE3BFCBA0, 0x5)         = 400 0
write(0x8, "127.0.0.1 - - [07/Nov/2018:17:04:19 +0800] \"GET /test.html HTTP/1.1\" 403 199 \"-\" \"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.77 Safari/537.36\"\n\0", 0xCC)        = 204 0

转载于:https://my.oschina.net/u/3669947/blog/2873243

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值