3

I'm trying to migrate a WordPress blog to a subdirectory of my website (i.e. example.com/blog/). Using NginX and FastCGI, I've managed to get the entire WordPress site working on port 8080, but as soon as I attempt to apply rules to place it in /blog, I get "No input file specified"

I think because I can get PHP and WordPress working, I can assume that there are no issues with my installation or the permissions of the relevant folders.

This is what my virtual host looks like (I am running a rails site at "/"):

    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;
    }

I have also tried this configuration for the same result:

    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;
    }

What am I doing wrong?

4

1 回答 1

0

你在使用多站点的 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 的文件夹。

于 2012-09-29T17:31:56.007 回答