目录

chevereto nginx rewrite 规则

目录

网上看了几篇规则倒是可以,但是我的用户名是admin,和后台管理界面冲突了,显示404。以下是官方的rewrite。

#Chevereto: Disable access to sensitive files
location ~* /(app|content|lib)/.*\.(po|php|lock|sql)$ {
    deny all;
}
#Chevereto: CORS headers
location ~* /.*\.(ttf|ttc|otf|eot|woff|woff2|font.css|css|js) {
    add_header Access-Control-Allow-Origin "*";
}
#Chevereto: Upload path for image content only and set 404 replacement
location ^~ /images/ {
    location ~* (jpe?g|png|gif) {
        log_not_found off;
        error_page 404 /content/images/system/default/404.gif;
    }
    return 403;
}
#Chevereto: Pretty URLs
location / {
    index index.php;
    try_files $uri $uri/ /index.php?$query_string;
}

In case you installed Chevereto in a sub folder, the rules should look like this(如果您将Chevereto安装在子文件夹中,则规则应如下所示:):

#Chevereto: Disable access to sensitive files
location ~* /sub/(app|content|lib)/.*\.(po|php|lock|sql)$ {
    deny all;
}
#Chevereto: CORS headers
location ~* /sub/.*\.(ttf|ttc|otf|eot|woff|woff2|font.css|css|js) {
    add_header Access-Control-Allow-Origin "*";
}
#Chevereto: Upload path for image content only and set 404 replacement
location ^~ /sub/images/ {
    location ~* (jpe?g|png|gif) {
        log_not_found off;
        error_page 404 /sub/content/images/system/default/404.gif;
    }
    return 403;
}
#Chevereto: Pretty URLs
location /sub/ {
    index index.php;
    try_files $uri $uri/ /sub/index.php?$query_string;
}

原文:https://chevereto.com/community/threads/nginx-rewrite-rules.9295/