我的知识记录

网站Nginx服务器无法实现伪静态化,在后台设置不成功

这主要是nginx的rewrite没有设置导致的

在nginx.conf里找到网站的server配置段,一般我们推荐如下的配置

    server {
        listen          80;
        server_name     yourdomain.com;
        root            /home/yourdomain/www/;
        index           index.html index.htm index.php;
 
        if (!-e $request_filename) {
            rewrite ^(.*)$ /index.php$1 last;
        }
 
        location ~ .*\.php(\/.*)*$ {
            include fastcgi.conf;
            fastcgi_pass  127.0.0.1:9000;
        }
 
        access_log logs/yourdomain.log combined;
    }

注意把以上配置中的yourdomain换成你自己的实际域名和实际目录存放地址

网站Nginx服务器无法实现伪静态化,在后台设置不成功

标签:

更新时间:2026-03-08 13:58:59

上一篇:网站加载速度慢,是什么问题导致的?

下一篇:文档修改日期能看出来吗?怎么看出文档修改过日期