我无法通过NGiNX执行PHP文件

这里是我从浏览器调用的configuration:

location ~ ^/getfileinfo/(.*)$ { proxy_pass http://127.0.0.1/editionspanda_conn/$1; } 

这是我的configuration,调用PHP文件:

 server { listen 127.0.0.1:80; server_name 127.0.0.1; root /var/www/localhost/public/; include /var/nginx/general/php; location ~ ^/editionspanda_conn/(.*)$ { root /var/www/EditionsPanda/livres.editionspanda.com/; try_files $uri $uri/ /index.php; fastcgi_pass unix:/var/run/php5-fpm.sock; } } 

在浏览器中,我得到这个错误:

 File not found. 

在我的错误日志中,我得到:

 2013/09/09 22:12:20 [error] 8922#0: *2784 FastCGI sent in stderr: "Primary script unknown" while reading response header from upstream, client: 127.0.0.1, server: 127.0.0.1, request: "GET /editionspanda_conn/name HTTP/1.0", upstream: "fastcgi://127.0.0.1:9000", host: "127.0.0.1" 
  • 我的版本的NGiNX是:1.2.7
  • 我正在使用Ubuntu 12。

与我的其他configuration,我没有访问一个PHP文件并执行它的问题。

我很确定Ubuntu的php5-fpm默认使用端口9000。 您可以通过将/etc/php5/fpm/pool.d/www.conf的listen行从127.0.0.1:9000更改为/var/run/php5-fpm.sock来将其更改为使用套接字。

更新:

如果你需要使用端口9000然后改变这个:

  location ~ ^/editionspanda_conn/(.*)$ { root /var/www/EditionsPanda/livres.editionspanda.com/; try_files $uri $uri/ /index.php; fastcgi_pass unix:/var/run/php5-fpm.sock; } 

对此:

  location ~ ^/editionspanda_conn/(.*)$ { root /var/www/EditionsPanda/livres.editionspanda.com/; try_files $uri $uri/ /index.php; fastcgi_pass 127.0.0.1:9000; } 

只要更换

 fastcgi_pass unix:/var/run/php5-fpm.sock; 

 fastcgi_pass 127.0.0.1:9000;