共计 1097 个字符,预计需要花费 3 分钟才能阅读完成。
在 Nginx 安装 WordPress 后一切正常。但是在 404 页面却遇到了问题。访问 abc.com/asdf 这些不存在的地址显示的是主题的 404 页面,但访问类似 abc.com/asdfg.php 以 ".php" 结尾的不存在地址却显示的是 Nginx 内置的 404 页面。怎么样才能让以 ".php" 结尾的地址也显示主题的 404 页面呢。下面是我的配置 upstream php { server 127.0.0.1:9000;}server { server_name .com; root /var/www/wordpress; index index.php; location = /favicon.ico { log_not_found off; access_log off; } location = /robots.txt { allow all; log_not_found off; access_log off; } location / { try_files $uri $uri/ /index.php?$args; } location ~ \\.php$ { include fastcgi_params; fastcgi_intercept_errors on; fastcgi_pass php; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; } location ~* \\.(js|css|png|jpg|jpeg|gif|ico)$ { expires max; log_not_found off; }} 复制代码 marcomarco 2023-02-06 17:05 2fastcgi_intercept_errors on 改成 off 试一下 poppy 2023-02-06 17:06 3location / { # file ($uri) or directory ($uri/)? if not, redirect to /index.php + query string try_files $uri $uri/ /index.php?$args; index index.html index.htm index.php;} 复制代码