簡體   English   中英

帶有FastCGI和WordPress的NginX在子目錄中 - “未指定輸入文件”

[英]NginX with FastCGI and WordPress in a subdirectory - “No input file specified”

我正在嘗試將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;
    }

我究竟做錯了什么?

您使用WordPress與Multisite?

我不清楚您的設置,但此列表中的教程肯定會對您有所幫助: http//rtcamp.com/wordpress-nginx/tutorial

如果您可以分享更多細節,我可以更好地指導您。

8080從哪里開始拍照? 你用Nginx和Apache嗎?

“沒有指定輸入文件”看起來像是與PHP文件的錯誤位置相關的錯誤...

嘗試改變

enter code here fastcgi_index index.php;

try_files index.php blog/index.php

假設'blog'是您移動WordPress的文件夾。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM