mirror of
https://github.com/encounter/decomp.me.git
synced 2026-03-30 11:06:27 -07:00
75 lines
1.9 KiB
Plaintext
75 lines
1.9 KiB
Plaintext
# nginx config file used by docker
|
|
|
|
server {
|
|
listen 80;
|
|
listen [::]:80;
|
|
client_max_body_size 5M;
|
|
client_body_buffer_size 1M;
|
|
|
|
root /var/www/;
|
|
|
|
server_name decomp.local www.decomp.local;
|
|
|
|
location / {
|
|
try_files $uri @proxy_frontend;
|
|
}
|
|
|
|
location ~ ^/api(/.*)?$ {
|
|
try_files $uri @proxy_api;
|
|
}
|
|
location /admin {
|
|
try_files $uri @proxy_api;
|
|
}
|
|
location /static {
|
|
try_files $uri @proxy_api;
|
|
}
|
|
location /media {
|
|
root /;
|
|
}
|
|
|
|
location @proxy_api {
|
|
proxy_intercept_errors on;
|
|
error_page 502 503 504 =200 @backend_down;
|
|
|
|
proxy_http_version 1.1;
|
|
proxy_set_header Connection "";
|
|
proxy_set_header X-Forwarded-Proto https;
|
|
proxy_set_header X-Url-Scheme $scheme;
|
|
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
|
proxy_set_header Host $http_host;
|
|
proxy_redirect off;
|
|
proxy_pass http://backend:8000;
|
|
}
|
|
|
|
location @proxy_frontend {
|
|
proxy_intercept_errors on;
|
|
error_page 502 503 504 =200 /down.html;
|
|
|
|
proxy_http_version 1.1;
|
|
proxy_set_header Connection "";
|
|
proxy_set_header X-Forwarded-Proto https;
|
|
proxy_set_header X-Url-Scheme $scheme;
|
|
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
|
proxy_set_header Host $http_host;
|
|
proxy_redirect off;
|
|
proxy_pass http://frontend:8080;
|
|
}
|
|
|
|
location /_next/webpack-hmr {
|
|
proxy_intercept_errors on;
|
|
error_page 502 503 504 =200 /down.html;
|
|
|
|
proxy_pass http://frontend:8080/_next/webpack-hmr;
|
|
proxy_http_version 1.1;
|
|
proxy_set_header Upgrade $http_upgrade;
|
|
proxy_set_header Connection "upgrade";
|
|
}
|
|
|
|
# Avoid returning HTML from the /api endpoint if backend is unavailable
|
|
location @backend_down {
|
|
add_header X-Backend-Down true always;
|
|
default_type application/json;
|
|
return 200 '{}';
|
|
}
|
|
}
|