-
-
Save ikuradon/cea9db19c081bdcd74d463e387039714 to your computer and use it in GitHub Desktop.
ConoHa👉Wasabi東海岸👉Wasabi西海岸移転時のnginx設定
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
proxy_cache_path /var/cache/nginx/media.comm.cx levels=1:2 keys_zone=media.comm.cx_cache:10m inactive=7d max_size=10g; | |
server { | |
listen 443 ssl http2; | |
listen [::]:443 ssl http2; | |
server_name media.comm.cx; | |
ssl_certificate /CERT/comm.cx.crt; | |
ssl_certificate_key /CERT/comm.cx.key; | |
include ssl.conf; | |
keepalive_timeout 70; | |
sendfile on; | |
#access_log /var/log/nginx/virtualhost_media.comm.cx.access.log; | |
root /opt/mastodon/code/public; | |
include pre.conf; | |
include gzip.conf; | |
expires 30d; | |
location / { | |
try_files $uri @wasabi; | |
index 500.html; | |
} | |
location @conoha { | |
add_header Access-Control-Allow-Origin "*"; | |
add_header Access-Control-Allow-Methods "GET, OPTIONS"; | |
add_header Access-Control-Allow-Headers "Origin, Authorization, Accept"; | |
add_header Access-Control-Allow-Credentials true; | |
add_header Cache-Control "public, max-age=31536000, immutable"; | |
set $pass /v1/nc_ffe78de52a844be7884955bfa194a412/media.comm.cx$uri; | |
proxy_pass https://object-storage.tyo1.conoha.io$pass; | |
proxy_buffering off; | |
proxy_redirect off; | |
proxy_http_version 1.1; | |
tcp_nodelay on; | |
proxy_cache media.comm.cx_cache; | |
proxy_cache_revalidate on; | |
proxy_cache_min_uses 2; | |
proxy_cache_use_stale timeout; | |
proxy_cache_lock on; | |
} | |
location @old { | |
add_header Access-Control-Allow-Origin "*"; | |
add_header Access-Control-Allow-Methods "GET, OPTIONS"; | |
add_header Access-Control-Allow-Headers "Origin, Authorization, Accept"; | |
add_header Access-Control-Allow-Credentials true; | |
add_header Cache-Control "public, max-age=31536000, immutable"; | |
proxy_pass http://media-comm-cx.s3.wasabisys.com; | |
proxy_buffering on; | |
proxy_redirect off; | |
proxy_http_version 1.1; | |
tcp_nodelay on; | |
proxy_cache media.comm.cx_cache; | |
proxy_cache_valid 200 7d; | |
proxy_cache_use_stale error timeout updating http_500 http_502 http_503 http_504; | |
add_header X-Cached $upstream_cache_status; | |
proxy_intercept_errors on; | |
recursive_error_pages on; | |
error_page 403 404 = @conoha; | |
} | |
location @wasabi { | |
add_header Access-Control-Allow-Origin "*"; | |
add_header Access-Control-Allow-Methods "GET, OPTIONS"; | |
add_header Access-Control-Allow-Headers "Origin, Authorization, Accept"; | |
add_header Access-Control-Allow-Credentials true; | |
add_header Cache-Control "public, max-age=31536000, immutable"; | |
set $pass /media.comm.cx$uri; | |
proxy_pass http://s3.us-west-1.wasabisys.com$pass; | |
proxy_buffering on; | |
proxy_redirect off; | |
proxy_http_version 1.1; | |
tcp_nodelay on; | |
proxy_cache media.comm.cx_cache; | |
proxy_cache_valid 200 7d; | |
proxy_cache_use_stale error timeout updating http_500 http_502 http_503 http_504; | |
add_header X-Cached $upstream_cache_status; | |
proxy_intercept_errors on; | |
recursive_error_pages on; | |
error_page 403 404 = @old; | |
} | |
error_page 400 403 404 500 501 502 503 504 /500.html; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment