首页 > 解决方案 > 子目录 nginx 中没有指定输入文件

问题描述

我正在尝试将index.php文件html夹中的文件设置为,将文件夹中localhost:5555的第二个index.php文件设置C:\\Users\\frisc\\GoogleDrive\\Other\\Personal Projects\\highlightForWord\\localhost:5555/highlighter.
首先一切正常,但第二个不行,当我去localhost:5555/highlighter打印时,No input file specified.
我还尝试将 phpMyAdmin 放在我html的 as 中localhost:5555/phpMyAdmin,即使没有location /phpMyAdmin阻止,一切正常nginx.conf
你能帮我吗?

nginx.conf

worker_processes  1;

events {
    worker_connections  1024;
}


http {
    include       mime.types;
    default_type  application/octet-stream;

    sendfile        on;

    server {
        listen       5555;
        server_name  localhost;

        location / {
            root   html;
            index  index.php;
        }
        
        location /highlighter {
            root   "C:\\Users\\frisc\\GoogleDrive\\Other\\Personal Projects\\highlightForWord\\";
            index  index.php;
        }
        
        location ~ \.php$ {
            fastcgi_pass   127.0.0.1:9123;
            fastcgi_index  index.php;
            fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
            include        fastcgi_params;
        }

        error_page   500 502 503 504  /50x.html;
        location = /50x.html {
            root   html;
        }
    }
}

更新
我的错误是在位置块中添加 2 个根,如果您有同样的错误,请尝试像这样从位置块移动根

worker_processes  1;

events {
    worker_connections  1024;
}


http {
    include       mime.types;
    default_type  application/octet-stream;

    sendfile        on;
    keepalive_timeout  65;

    server {
        listen       5555;
        server_name  localhost;

        root   "D:\\Miscellaneous\\nginxSites";
        
        location / {
            index  index.php;
        }
        
        location /highlighter {
            index  index.php;
        }
        
        location ~ \.php$ {
            fastcgi_pass   127.0.0.1:9123;
            fastcgi_index  index.php;
            fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
            include        fastcgi_params;
        }

        error_page   500 502 503 504  /50x.html;
        location = /50x.html {
            root   html;
        }
    }
}

标签: phpnginxsubdomainconfigsubdirectory

解决方案


推荐阅读