欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  后端开发

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

程序员文章站 2022-03-10 14:05:43
...
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不同

相关标签: php nginx