Chevereto 图床的Nginx伪静态规则

# Context limits
client_max_body_size 20M;

# Disable access to sensitive files
location ~* (app|content|lib)/.*\.(po|php|lock|sql)$ {
deny all;
}

# Image not found replacement
location ~ \.(jpe?g|png|gif|webp)$ {
log_not_found off;
error_page 404 /content/images/system/default/404.gif;
}

# CORS header (avoids font rendering issues)
location ~ \.(ttf|ttc|otf|eot|woff|woff2|font.css|css|js)$ {
add_header Access-Control-Allow-Origin "*";
}

# Pretty URLs
location / {
index index.php;
try_files $uri $uri/ /index.php$is_args$query_string;
}

添加CDN所需的伪静态

location ~ /\.ht {
    deny all;
}
location ~ /(app|content|lib|importer)/.*\.(po|php|lock|sql|txt)$ {
   deny all;
}
location ~* \.(ttf|ttc|otf|eot|woff|woff2|css|js)$ {
    add_header Access-Control-Allow-Origin "*";
}
location /images {}
location / {
    try_files $uri $uri/ /index.php$is_args$query_string;
}

Views: 14

留下评论

您的电子邮箱地址不会被公开。 必填项已用 * 标注