php - 使用 nginx 的 wordpress 空白页面

标签 php linux wordpress nginx

我将我的网络服务器 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/

相关文章:

php - PHP 中 empty() 的神奇功能是什么?

Php:如何在where子句下使用$_POST

python - 树莓派 : issue communicating via I2C

php - 如何使用 HTML 和 CSS 在 WordPress 中自定义帖子?

php - Yii 框架 + WP 风格(使用 WP 数据库表)后层次结构 : I need to order categories and subcategories

php - Amazon S3 如何验证访问 key ID 和 secret 访问 key ? PHP SDK v3

php - 文件上传大小验证

linux - Ubuntu 14.04 上的多系统

linux - 为 Docker 容器创建共享包缓存文件夹

php - 将自定义 CSS 添加到 Wordpress 中的特定模板页面