【问题标题】:NginX with FastCGI and WordPress in a subdirectory - "No input file specified"子目录中带有 FastCGI 和 WordPress 的 NginX - “未指定输入文件”
【发布时间】:2012-09-02 09:11:40
【问题描述】:

我正在尝试将 WordPress 博客迁移到我网站的子目录(即 example.com/blog/)。使用 NginX 和 FastCGI,我设法让整个 WordPress 站点在端口 8080 上运行,但是当我尝试应用规则将其放置在 /blog 中时,我得到“未指定输入文件”

我认为因为我可以让 PHP 和 WordPress 工作,我可以假设我的安装或相关文件夹的权限没有问题。

这就是我的虚拟主机的样子(我在“/”处运行一个 rails 站点):

    server {
    listen       80;
    server_name  example.com localhost;

    #charset koi8-r;

    #access_log  logs/host.access.log  main;

    location /blog/ {
        root /home/deploy/www/blog.example.com/html;
        index index.php;
        try_files $uri $uri/ /blog/index.php;
    }

    location ~ \.php$ {
        root /home/deploy/www/blog.example.com/html;
        fastcgi_pass 127.0.0.1:9000;
        fastcgi_index index.php;
        include fastcgi_params;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
    }

    location / {
        root   /home/deploy/www/example.com/public;
        passenger_enabled on;
        index  index.html index.htm;
    }

我也尝试过这种配置以获得相同的结果:

    location ~ ^/blog/.*(\.php)?$ {
           fastcgi_split_path_info ^(.+\.php)(.*)$;
           root   /home/deploy/www/blog.example.com/html;
           try_files $uri =404;
    #        fastcgi_split_path_info ^(/blog/.+\.php)(.*)$;

            #fastcgi_split_path_info ^(.+\.php)(/.+)$;
            #NOTE: You should have "cgi.fix_pathinfo = 0;" in php.ini

            include fastcgi_params;
            fastcgi_index index.php;
            fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
    #       fastcgi_intercept_errors on;
          fastcgi_pass 127.0.0.1:9000;
    }

我做错了什么?

【问题讨论】:

标签: php wordpress nginx fastcgi


【解决方案1】:

您在使用多站点的 WordPress 吗?

我不清楚您的设置,但此列表中的教程肯定会对您有所帮助:http://rtcamp.com/wordpress-nginx/tutorial

如果你能分享更多细节,我可以更好地指导你。

8080 从何而来?你用 Nginx 和 Apache 吗??

“未指定输入文件”看起来像是与 PHP 文件位置不正确有关的错误...

尝试改变

enter code herefastcgi_index index.php;

try_files index.php blog/index.php

假设“博客”是您移动 WordPress 的文件夹。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2015-11-22
    • 1970-01-01
    • 1970-01-01
    • 2015-12-15
    • 1970-01-01
    • 1970-01-01
    • 2017-06-01
    相关资源
    最近更新 更多