【发布时间】:2017-02-03 19:02:20
【问题描述】:
我有一个 wordpress 网站,其永久链接设置为帖子名称。除索引外,所有页面均未出现并返回 404。如果我将其设置为普通,那么它们会出现,但缺少许多资源,我不确定为什么。
所以要明确一点,如果永久链接是普通的,它可以工作,但是会有很多错误,因为多个文件(索引除外)上存在 404。 如果 permalink 是 postname,那么整个页面就是 404。
这是我的 htaccess 文件、我的 nginx 配置和我的 php-fpm 配置。 谁能看出问题?
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress
NGINX 会议
server {
listen 80;
server_name www.example.com example.com;
root /var/www/example;
return 301 https://$server_name$request_uri;
}
server {
listen 443 ssl;
server_name www.example.com example.com;
root /var/www/example;
index index.php;
ssl_certificate /etc/nginx/ssl/example.com/example.com.crt;
ssl_certificate_key /etc/nginx/ssl/example.com/example.com.key;
access_log /var/log/nginx/example.log main;
error_log /var/log/nginx/example_error.log;
location / {
root /var/www/example;
}
error_page 404 /404.html;
location = /404.html {
root /usr/share/nginx/html;
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/html;
}
location ~ \.php$ {
fastcgi_pass 127.0.0.1:9001;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
}
PHP-FPM
[example]
listen = 127.0.0.1:9001
listen.allowed_clients = 127.0.0.1
user = nginx
group = nginx
...and some more I don't think is relevant but I can supply if asked for.
感谢您的帮助!
【问题讨论】:
标签: php wordpress .htaccess nginx centos7