|
|
在 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;
- }
- }
复制代码 |
|