update nginx config
This commit is contained in:
@@ -1,12 +1,10 @@
|
||||
proxy_cache_path /tmp/nginx-cache levels=1:2 keys_zone=STATIC:100m max_size=1000m inactive=24h use_temp_path=off;
|
||||
|
||||
server {
|
||||
listen 80;
|
||||
server_name __hostname__;
|
||||
root /var/www/danbooru2/current/public;
|
||||
root /var/www/danbooru/current/public;
|
||||
index index.html;
|
||||
access_log /var/log/nginx/danbooru.access.log;
|
||||
error_log /var/log/nginx/danbooru.error.log;
|
||||
access_log off;
|
||||
error_log off;
|
||||
client_max_body_size 35m;
|
||||
location /stylesheets {
|
||||
expires max;
|
||||
@@ -16,9 +14,6 @@ server {
|
||||
expires max;
|
||||
break;
|
||||
}
|
||||
#location /ssd {
|
||||
# rewrite ^/ssd(.*)$ $1;
|
||||
#}
|
||||
location /data {
|
||||
# if you want to block hotlinking
|
||||
valid_referers none __hostname__ ~\.google\. ~\.bing\. ~\.yahoo\.;
|
||||
@@ -31,40 +26,15 @@ server {
|
||||
break;
|
||||
}
|
||||
|
||||
# to enable s3 proxy
|
||||
location ~ ^/cached/data/(.+) {
|
||||
rewrite ^/cached/data/sample/__.+?__(.+) /cached/data/sample/$1;
|
||||
rewrite ^/cached/data/__.+?__(.+) /cached/data/$1;
|
||||
if ($uri ~ "/cached/data/(.+)") {
|
||||
set $s3_bucket 's3.amazonaws.com';
|
||||
set $url_full $1;
|
||||
}
|
||||
|
||||
proxy_set_header Host $s3_bucket;
|
||||
proxy_set_header Authorization '';
|
||||
proxy_hide_header x-amz-id-2;
|
||||
proxy_hide_header x-amz-request-id;
|
||||
proxy_hide_header Set-Cookie;
|
||||
|
||||
proxy_cache STATIC;
|
||||
proxy_ignore_headers Set-Cookie Cache-Control X-Accel-Expires Expires;
|
||||
proxy_cache_valid 200 48h;
|
||||
proxy_cache_use_stale error timeout invalid_header updating http_500 http_502 http_503 http_504;
|
||||
proxy_cache_key "$uri";
|
||||
proxy_cache_min_uses 2;
|
||||
add_header X-Cache-Status $upstream_cache_status;
|
||||
proxy_pass https://$s3_bucket/BUCKET_NAME/$url_full;
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
location /maintenance.html {
|
||||
expires 10;
|
||||
}
|
||||
|
||||
if (-f $document_root/maintenance.html) {
|
||||
rewrite ^(.*)$ /maintenance.html last;
|
||||
break;
|
||||
}
|
||||
|
||||
location @app_server {
|
||||
proxy_pass http://app_server;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
@@ -77,6 +47,7 @@ server {
|
||||
location / {
|
||||
try_files $uri @app_server;
|
||||
}
|
||||
|
||||
error_page 404 /404.html;
|
||||
error_page 500 502 503 504 /500.html;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user