当前位置:Gxlcms > PHP教程 > nginx-访问挂载的win下共享目录php文件出错

nginx-访问挂载的win下共享目录php文件出错

时间:2021-07-01 10:21:17 帮助过:1人阅读

ubuntu 做了一个php的开发环境,然后想把win下的开发目录共享 挂载到 ubuntu下。

然而出现了奇怪的问题:

nginx: File not found.

查看nginx log

> FastCGI sent in stderr: "Primary script unknown" while reading
> response header from upstream, client: 192.168.199.212, server:
> tqq.dev.com, request: "GET /ly/test2.php HTTP/1.1", upstream:
> "fastcgi://127.0.0.1:9000" host: "tqq.dev.com", referrer:
> "http://tqq.dev.com/ly/"

附上nginx 配置

server {
    listen       80;
    server_name  tqq.dev.com;

    root /usr/local/dev;

    #charset koi8-r;

    #access_log  logs/host.access.log  main;

    location / {
        index  index.html index.htm;
    }

    #error_page  404              /404.html;

    # redirect server error pages to the static page /50x.html
    #
    error_page   500 502 503 504  /50x.html;
    location = /50x.html {
        root   html;
    }

    # proxy the PHP scripts to Apache listening on 127.0.0.1:80
    #
    #location ~ \.php$ {
    #    proxy_pass   http://127.0.0.1;
    #}

    # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
    #
    location ~ \.php$ {
        fastcgi_pass   127.0.0.1:9000;
        fastcgi_index  index.php;
        fastcgi_param  SCRIPT_FILENAME $document_root$fastcgi_script_name;
        include        fastcgi_params;
    }

    # deny access to .htaccess files, if Apache's document root
    # concurs with nginx's one
    #
    #location ~ /\.ht {
    #    deny  all;
}

/usr/local/dev;目录下php文件访问正常,新建目录创建php文件访问也是正常的,唯独挂载在dev目录下的共享文件夹下面的 php 文件不能正常访问,html文件访问正常

回复内容:

ubuntu 做了一个php的开发环境,然后想把win下的开发目录共享 挂载到 ubuntu下。

然而出现了奇怪的问题:

nginx: File not found.

查看nginx log

> FastCGI sent in stderr: "Primary script unknown" while reading
> response header from upstream, client: 192.168.199.212, server:
> tqq.dev.com, request: "GET /ly/test2.php HTTP/1.1", upstream:
> "fastcgi://127.0.0.1:9000" host: "tqq.dev.com", referrer:
> "http://tqq.dev.com/ly/"

附上nginx 配置

server {
    listen       80;
    server_name  tqq.dev.com;

    root /usr/local/dev;

    #charset koi8-r;

    #access_log  logs/host.access.log  main;

    location / {
        index  index.html index.htm;
    }

    #error_page  404              /404.html;

    # redirect server error pages to the static page /50x.html
    #
    error_page   500 502 503 504  /50x.html;
    location = /50x.html {
        root   html;
    }

    # proxy the PHP scripts to Apache listening on 127.0.0.1:80
    #
    #location ~ \.php$ {
    #    proxy_pass   http://127.0.0.1;
    #}

    # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
    #
    location ~ \.php$ {
        fastcgi_pass   127.0.0.1:9000;
        fastcgi_index  index.php;
        fastcgi_param  SCRIPT_FILENAME $document_root$fastcgi_script_name;
        include        fastcgi_params;
    }

    # deny access to .htaccess files, if Apache's document root
    # concurs with nginx's one
    #
    #location ~ /\.ht {
    #    deny  all;
}

/usr/local/dev;目录下php文件访问正常,新建目录创建php文件访问也是正常的,唯独挂载在dev目录下的共享文件夹下面的 php 文件不能正常访问,html文件访问正常

看下php的配置文件,看运行php的User和Group是否和nginx不同

人气教程排行