我需要一些NginX专业知识。
我正在使用NginX配置Safari推送通知Web服务。当前端请求许可时,Safari代理将无法连接并使用404获取推包:
NginX访问日志:
159.192.217.13 - - [09/Jul/2018:06:26:15 +0100] "POST /push/v2/pushPackages/web.com.domain.co HTTP/1.1" 404 56 "-" "SafariNotificationAgent (unknown version) CFNetwork/901.1 Darwin/17.6.0 (x86_64)" "-"
159.192.217.13 - - [09/Jul/2018:06:26:15 +0100] "POST /push/v1/pushPackages/web.com.domain.co HTTP/1.1" 301 185 "-" "SafariNotificationAgent (unknown version) CFNetwork/901.1 Darwin/17.6.0 (x86_64)" "-"
159.192.217.13 - - [09/Jul/2018:06:26:16 +0100] "GET /push/v1/pushPackages/web.com.domain.co HTTP/1.1" 403 169 "-" "SafariNotificationAgent (unknown version) CFNetwork/901.1 Darwin/17.6.0 (x86_64)" "-"
NginX错误日志:
2018/07/09 06:26:15 [error] 2774#0: *23 FastCGI sent in stderr: "Unable to open primary script: /www/data/push/v2/pushPackages/web.com.domain.co (No such file or directory)" while reading response header from upstream, client: 159.192.217.13, server: domain.com, request: "POST /push/v2/pushPackages/web.com.domain.co HTTP/1.1", upstream: "fastcgi://127.0.0.1:9000", host: "domain.com"
2018/07/09 06:26:16 [error] 2774#0: *23 directory index of "/www/data/push/v1/pushPackages/web.com.domain.co/" is forbidden, client: 159.192.217.13, server: domain.com, request: "GET /push/v1/pushPackages/web.com.domain.co/ HTTP/1.1", host: "domain.com"
2018/07/09 06:26:18 [error] 2774#0: *25 directory index of "/www/data/push/v1/log/" is forbidden, client: 159.192.217.13, server: domain.com, request: "GET /push/v1/log/ HTTP/1.1", host: "domain.com"
(已用domain.com替换服务器)
NginX位置配置文件:
location /push/v2/pushPackages/web.com.domain.co {
add_header "Access-Control-Allow-Origin" *;
allow all;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
我确信此配置不正确。
它指向目录/push/v2/pushPackages/web.com.domain.co
,其中index.php随后生成推包zip,但是似乎找不到索引。