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

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

in 码农技术宅 with 2 comments

伪静态官方说明

    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 / Cancel Reply
  1. gui

    这个文件在哪里啊,怎么改,求助

    Reply
  2. `rewrite ^(\/admin/.*)$ $1 break;`,应该是不让防止 /admin 被规则替换为 /index.php/admin

    Reply
京ICP备15030655号-1