【发布时间】:2016-08-01 17:23:57
【问题描述】:
我设置了2台服务器,一台是nginx,80端口。 B 服务器是 php 和 apache ,端口 80 。如果我访问 B:80/index.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,但我就是想试试这种方式,当我访问A:80/index.php时,它下载的是php文件而不是执行它,这是什么问题?
【问题讨论】: