我把头撞在墙上,试图启动nginx并使用php5-fpm运行.我觉得这只是我忽略的一个小细节,所以我休息了一会儿,几天后又回到了上面.今晚又弄乱了几个小时,无济于事.
无论如何,这就是问题所在:我已经启动并运行了nginx.它似乎可以正确提供网页.例如,基本网站http://www.shidenadvanced.com可以正常运行.但是,我位于http://www.shidenadvanced.com/test.php的php测试返回为空白.以前,它是作为502错误网关返回的.
通过研究,我了解到这意味着它无法正确地通过php-fpm进行路由.并非100%.
这是我的/ sites-available / config:
server {
server_name www.shidenadvanced.com shidenadvanced.com;
access_log /srv/sites/shidenadvanced/logs/access.log;
error_log /srv/sites/shidenadvanced/logs/error.log;
root /srv/sites/shidenadvanced/www;
index index.php index.html index.htm;
location / {
try_files $uri $uri/ /index.html;
}
#location ~ \.php${
# try_files $uri =404;
# include /etc/nginx/fastcgi_params;
# fastcgi_pass unix:/var/run/php-fpm5.sock;
# fastcgi_index index.php;
# fastcgi_param SCRIPT_FILENAME /srv/sites/shidenadvanced/www$fastcgi_script_name;
#}
location ~ \.php${
try_files $uri =404;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_index index.php;
include fastcgi_params;
}
location ~ /\.ht {
deny all;
}
}
除此以外,我不理会大多数设置.不能完全确定发生了什么.谁能阐明一些想法?
最佳答案
尝试这个.我对您处理fastcgi的方式做了一些更改
server {
server_name www.shidenadvanced.com shidenadvanced.com;
access_log /srv/sites/shidenadvanced/logs/access.log;
error_log /srv/sites/shidenadvanced/logs/error.log;
root /srv/sites/shidenadvanced/www;
index index.php index.html index.htm;
location / {
try_files $uri $uri/ /index.html;
}
# use fastcgi for all php files
location ~ \.php$
{
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
location ~ /\.ht {
deny all;
}
}
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。