我将我的网络服务器 apache2 切换到 centos 7 上的 nginx,现在主 index.php 显示一个空白页面,但 wp-admin 工作正常。在 Web 控制台中,我可以看到 200 响应。我启用了 wp debug 但没有运气。这是我的主机文件
server {
root /var/www/html;
index index.php index.html index.htm;
server_name new-site.com;
location = /favicon.ico {
log_not_found off;
}
location / {
try_files $uri $uri/ /index.php?$args;
}
location ~ \.php$ {
try_files $uri =404;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass unix:/var/run/php-fpm/php-fpm.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
}
最佳答案
Google 搜索了很多小时,我找到了解决方案,这对我来说是有效的配置,将 include fastcgi_params;
更改为 include fastcgi.conf;
location ~ \.php$ {
try_files $uri =404;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
include fastcgi.conf;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
#include fastcgi_params;
fastcgi_pass unix:/var/run/php-fpm/php-fpm.sock;
}
关于php - 使用 nginx 的 wordpress 空白页面,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42543658/