2016-02-21 38 views
0

我想使用Nginx和Symfony 3的一個新項目來設置我的環境,兩者都可以正常工作(通過啓動php-cgi.exe -b 127.0.0.1啓動Nginx :9000或使用server:run啓動Symfony 3項目),但是,我無法通過Nginx獲得Symfony的工作。Windows 10 - Nginx和Symfony 3配置

該錯誤消息我在日誌中得到是這樣的:

2016/02/21 00:36:33 [error] 6260#1732: *1 upstream timed out (10060: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond) while connecting to upstream, client: 127.0.0.1, server: localhost, request: "GET/HTTP/1.1", upstream: "fastcgi://127.0.0.1:9000", host: "localhost" 

這是我在nginx.conf代碼服務器節至今:

server { 
     listen  80; 
     server_name localhost; 
     root www/projects/mysite.com/web; 

     rewrite ^/app\.php/?(.*)$ /$1 permanent; 

     location/{ 
      index app.php; 
      try_files $uri @rewriteapp; 
     } 

     location @rewriteapp { 
      rewrite ^(.*)$ /app.php/$1 last; 
     } 

     error_page 500 502 503 504 /50x.html; 
      location = /50x.html { 
     } 

     location ~ ^/(app|app_dev|config)\.php(/|$) { 
      fastcgi_pass 127.0.0.1:9000; 
      fastcgi_split_path_info ^(.+\.php)(/.*)$; 
      fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; 
      include  fastcgi_params; 
     } 
    } 

我已經放在50x.html文件在我的/ web文件夾中,並且在超時後顯示正確...

回答

0

我可以理解你使用的是Unix/Linux機器。這是因爲您尚未啓用(授予上游特權)。

setsebool -P httpd_can_network_connect true 

默認情況下被selinux阻塞的上游。請讓我知道如果這修復。

謝謝。

+0

err我在windows上編輯標題以避免混淆:) – Estarius