typecho 配置伪静态,解决静态资源找不到问题
in 码农技术宅 with 0 comment

typecho 配置伪静态,解决静态资源找不到问题

in 码农技术宅 with 0 comment

伪静态官方说明

    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;
    }

nginx配置修改

    if (!-e $request_filename) {
        rewrite ^(.*\.(css|js))$ $1 break;
        rewrite ^(.*\.(gif|jpg|jpeg|bmp|png|ico|txt|apk|flv|swf|mp4))$ $1 break;
        rewrite ^(.*\.(woff|woff2|ttf))$ $1 break;
        rewrite ^(\/admin/.*)$ $1 break;
        rewrite ^(.*)$ /index.php$1 last;
    }

rewrite 基本知识点

flag标志位

全局变量

参考文章

Responses