宝塔面板nginx报 404和502问题
1.打开伪静态
2.在创建站点时报:404 Not Found问题:
具体配置内容:
server
{
listen 80;
server_name www.yxw.com;
index index.php;
root /work/yxw;
#error_page 404 /404.html;
location /
{
index index.php;
#ThinkPHP REWRITE支持
if (!-e $request_filename) {
rewrite ^/(.*)$ /index.php?s=$1 last;
}
#301 跳转设置
if ($host = 'www.yxw.com') {
rewrite ^/(.*) http://www.yxw.cn/$1 permanent;
}
}
location ~ [^/]\.php(/|$)
{
# comment try_files $uri =404; to enable pathinfo
try_files $uri =404;
fastcgi_pass unix:/tmp/php-cgi-70.sock;#这里的版本要和安装php的版本一样的
fastcgi_index index.php;
include fastcgi.conf;
#include pathinfo.conf;
}
location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$
{
expires 30d;
}
location ~ .*\.(js|css)?$
{
expires 12h;
}
#access_log /work/yxw/yxw.log access;
}
3.报错:nginx 502 Bad Gateway
fastcgi_pass unix:/tmp/php-cgi-70.sock;#这里的版本要和安装php的版本一样的