宝塔面板nginx报错404

发布于:2023-07-04 ⋅ 阅读:(73) ⋅ 点赞:(0)

版权声明:本文为博主原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。
本文链接:https://blog.csdn.net/weixin_38112233/article/details/83502798
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的版本一样的

 

本文含有隐藏内容,请 开通VIP 后查看

网站公告

今日签到

点亮在社区的每一天
去签到