首页 > 代码库 > Nginx 配置说明

Nginx 配置说明

Nginx支持伪静态(在 nginx.conf 中 修改如下)参考链接

location / {
        index index.html index.php;
        if (-d $request_filename){
                rewrite ^/(.*)([^/])$ $1$2/ permanent;
        }
        if (-f $request_filename/index.html){
                rewrite (.*) $1/index.hrml break;
        }
        if (-f $request_filename/index.php){
                rewrite (.*) $1/index.php;
        }
        if (!-f $request_filename){
                rewrite (.*) /index.php;
        }
}

 

Nginx Gzip 启用 参考链接

gzip on;
gzip_min_length 1k;
gzip_buffers 16 64k;
gzip_http_version 1.1;
gzip_comp_level 6;
gzip_types text/plain application/x-javascript text/css application/xml;
gzip_vary on;