2016-08-01 64 views
0

我設置了2個服務器,一個服務器是nginx,端口80。 B服務器是PHP與Apache,端口80。如果我訪問B:80/index.php,它可以正常工作。nginx將php請求傳遞給一個php-apache服務器,但下載而不是執行php文件

在服務器A上,Nginx的CONF:

location ~ .*\.php$ { 
#fastcgi_pass B:80; 
#  fastcgi_index index.php; 
#  fastcgi_param SCRIPT_FILENAME$document_root$fastcgi_script_name; 
#  include fastcgi_params; 
      proxy_pass http://B:80; 
      proxy_redirect off; 
      proxy_set_header Host $host; 
      proxy_set_header X-Real-IP $remote_addr; 
      proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; 
      proxy_next_upstream error timeout invalid_header http_500 http_502 http_503 http_504; 

是的,我知道的FastCGI,但我只是想試試這樣一來,當我訪問答:80/index.php文件,它下載PHP文件而不是執行它,這是什麼問題?

回答

0

問題解決了,評論這條線在nginx.conf

include /etc/nginx/conf.d/*.conf; 
相關問題