[英]nginx trouble loading index file
我有這個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 cofig文件
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?
更新:您在此處顯示的配置仍然完全不包含有關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;
}
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.