我已经设置了我的nginx,但是现在我的虚拟主机上的每个* .php文件都返回500个内部服务器错误。nginx和apache(php)
server {
listen tucnak.dev:80; ## listen for ipv4; this line is default and implied
root /home/tucnak/Web/Lab;
index index.php index.html;
server_name tucnak.dev;
location/{
# First attempt to serve request as file, then
# as directory, then fall back to index.html
try_files $uri $uri/ /index.html;
}
location /doc {
root /usr/share;
autoindex on;
allow 127.0.0.1;
deny all;
}
location /images {
root /usr/share;
autoindex off;
}
#error_page 404 /404.html;
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/www;
}
location ~ \.php$ {
proxy_pass http://127.0.0.1;
}
location ~ \.php$ {
set $php_root /home/tucnak/Web/Lab;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $php_root$fastcgi_script_name;
include /etc/nginx/fastcgi_params;
}
# deny access to .htaccess files, if Apache's document root
# concurs with nginx's one
#
#location ~ /\.ht {
# deny all;
#}
}
我的错误在哪里?我的php文件是完全正确的!
<?php echo("Hello!"); ?>
我真的是nginx新手,需要帮助。 apache2之后 - 我很困惑!
UPD:我认为nginx没有成功给出apache的查询。我不知道如何解决它。
你为什么同时使用'proxy_pass'和'fastcgi_pass'? – Rifat 2012-02-18 21:43:11
没有它(proxy_pass)他提供我的下载.php文件) – tucnak 2012-02-18 22:03:34
您可能需要删除其中一个位置位置〜\ .php $它不清楚,您使用的是Apache后端还是fastcgi。我认为nginx不能解决这个问题 – ykhrustalev 2012-02-18 22:17:10