我有这个nginx vhost文件
server { # php/fastcgi
listen 80;
server_name trinityplex.com www.trinity.com;
access_log /home/web/trinity_web/log/access.log;
root /home/web/trinity_web/public;
location / {
index index.html index.htm index.php;
}
}
(域trinityplex.com),但如果我去trinityplex.com nginx显示我502坏网关和抛出索引文件- chrome下载index.php像一个正常的下载
太可笑了,我从来没见过那个。如果我问PHP版本它会转储PHP 5.3.5-0.dotdeb.0 with Suhosin-Patch (cli) (built: Jan 7 2011 00:30:52)
Copyright (c) 1997-2009 The PHP Group
Zend Engine v2.3.0, Copyright (c) 1998-2010 Zend Technologies
with Suhosin v0.9.32.1, Copyright (c) 2007-2010, by SektionEins GmbH
你有什么办法解决这个问题吗?
这是一个nginx配置文件
user root;
worker_processes 1;
events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
sendfile on;
keepalive_timeout 65;
server_names_hash_bucket_size 128;
gzip on;
include /usr/local/nginx/sites-enabled/*;
}
您没有在服务器部分配置PHP,因此PHP文件显然将以纯文本形式发送。您打算如何运行PHP?FastCGI吗?
Update:您在这里显示的配置仍然不包括任何关于PHP或FastCGI的内容。试试这样做:
# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
#
location ~ .php$ {
fastcgi_pass 127.0.0.1:9000;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_index index.php;
include fastcgi_params;
}