【发布时间】:2020-07-09 12:43:55
【问题描述】:
我正在学习 NGINX,因此非常感谢任何帮助。
我有一个网站的前端作为 mysite.com 的根运行,现在我想从 mysite.com/blog 运行 wordpress。
我的文件结构是: /srv/mysite/前端 /srv/mysite/wordpress
这是我从 nginx 日志中得到的错误
2020/03/29 00:09:03 [error] 23049#23049: *39 FastCGI sent in stderr: "Primary script unknown" while reading response header from upstream, client: XXXXXXX, server: www.mysite.com, request: "GET /api HTTP/1.1", upstream: "fastcgi://unix:/run/php/php7.2-fpm.sock:", host: "mysite.com"
这是我目前的 nginx 配置文件
listen 80 default_server;
server_name www.mysite.com mysite.com;
charset utf-8;
location ^~ /blog {
root /srv/mysite/wordpress;
}
location ~ \.php$ {
fastcgi_pass unix:/run/php/php7.2-fpm.sock;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param SCRIPT_NAME $fastcgi_script_name;
}
location / {
root /srv/mysite/frontend/dist;
try_files $uri /index.html;
}
}
【问题讨论】: