nginx rewrite rules

Rodolfo

Chevereto Developer
Chevereto Staff
Hey there,

These are the updated nginx rewrite rules for Chevereto. You must add these to your nginx.conf server block and restart nginx to apply changes.

Code:
#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:
Code:
#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;
}
Replace /sub/ with the sub folder that matches your installation. For nested folders you can use /sub1/sub2/subn/

Hope it helps,
Rodolfo.
 
Top