【发布时间】:2019-07-13 05:55:49
【问题描述】:
我在主机的子位置的 php 页面上收到 404 错误。 我的配置是:
server {
listen 80;
root /var/www/html/nisite;
index index.php index.html index.htm;
server_name www2.company.com wp-newsite-stg-02.company.com;
location / {
try_files $uri $uri/ /index.php?$args;
}
location ~ \.php$ {
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_index index.php;
fastcgi_pass unix:/var/run/php/php7.2-fpm.sock;
include fastcgi_params;
fastcgi_param PATH_INFO $fastcgi_path_info;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
}
# =================================
location /office {
root /var/www/html/oldsite;
}
}
当我转到 http://www2.company.com/office 时,我可以看到该页面,所有静态资产也都已提供,但是当我尝试访问 http://www2.company.com/office/php/form-process.php 时,我收到 404 错误。
为什么location ~ \.php$ 不能正确处理这个请求?
谢谢。
【问题讨论】:
标签: php nginx nginx-config