Heim >Backend-Entwicklung >PHP-Tutorial >nginx - 访问挂载的win下共享目录 php文件出错

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

WBOY
WBOYOriginal
2016-06-06 20:30:101286Durchsuche

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不同

Stellungnahme:
Der Inhalt dieses Artikels wird freiwillig von Internetnutzern beigesteuert und das Urheberrecht liegt beim ursprünglichen Autor. Diese Website übernimmt keine entsprechende rechtliche Verantwortung. Wenn Sie Inhalte finden, bei denen der Verdacht eines Plagiats oder einer Rechtsverletzung besteht, wenden Sie sich bitte an admin@php.cn