首页  >  文章  >  后端开发  >  nginx - 访问挂载的win下共享目录 php文件出错

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

WBOY
WBOY原创
2016-06-06 20:30:101251浏览

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

然而出现了奇怪的问题:

nginx: File not found.

查看nginx log

<code>> 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/"
</code>

附上nginx 配置

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

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

回复内容:

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

然而出现了奇怪的问题:

nginx: File not found.

查看nginx log

<code>> 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/"
</code>

附上nginx 配置

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

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

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

声明:
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn