NGINX错误日志内容如下:
2018/09/30 20:01:02 [error] 19321#19321: *2877 FastCGI sent in stderr: "Primary script unknown" while reading response header from upstream, client: 117.163.227.90, server: 4spaces.org, request: "GET /plus/90sec.php HTTP/1.1", upstream: "fastcgi://127.0.0.1:9000", host: "www.4spaces.org", referrer: "http://bijie.jinti.com/plugins/weathermap/configs/test404.php"
解决办法如下:
修改nginx配置文件,
location ~ \.php$ {
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name;
include fastcgi_params;
}
将上面的内容修改为:
location ~ \.php$ {
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root/$fastcgi_script_name;
include fastcgi_params;
}
$document_root 代表当前请求在root指令中指定的值:
server {
listen 443 ssl http2;
server_name 4spaces.org www.4spaces.org;
index index.php index.html index.htm;
root /etc/nginx/html/rxblog;
add_header X-Frame-Options DENY;
add_header X-Content-Type-Options nosniff;
ssl_certificate /etc/letsencrypt/live/4spaces.org/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/4spaces.org/privkey.pem;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_ciphers EECDH+CHACHA20:EECDH+CHACHA20-draft:EECDH+AES128:RSA+AES128:EECDH+AES256:RSA+AES256:EECDH+3DES:RSA+3DES:!MD5;
ssl_prefer_server_ciphers on;
ssl_session_cache shared:SSL:10m;
ssl_session_timeout 60m;
location / {
try_files $uri $uri/ /index.php?$args;
}
location ~ \.php$ {
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root/$fastcgi_script_name;
include fastcgi_params;
}
}
上面的配置表示:针对/etc/nginx/html/rxblog/目录下的php文件进行解析。
参考文章:
最新评论
我的是ipv4网络,如何使用直播源啊!
我今天试了,不想啊,我的是新疆昌吉移动的网络。
收不到验证码电报
现在充值29起了