Chevereto 在 Nginx 下的伪静态规则

发布于 2020-03-13  46 次阅读


鉴于nginx的种种优点,我断然放弃了Apache。
但在安装完后,出现了久违的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_filesuri uri/ /index.php?query_string;
}