aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorShyam Sunder2019-09-16 08:36:56 -0400
committerShyam Sunder2019-09-16 08:36:56 -0400
commitfa3b6275b321aeba92395fbe563befb10aab5e90 (patch)
treee67d641f3d81f257caa054de09598a5d3db79394
parent54eab0aa352b432dcb1c327183156a0187536650 (diff)
client/nginx: minor tweaks to nginx config
-rw-r--r--client/nginx.conf.docker41
1 files changed, 36 insertions, 5 deletions
diff --git a/client/nginx.conf.docker b/client/nginx.conf.docker
index bae19e7..bd421f5 100644
--- a/client/nginx.conf.docker
+++ b/client/nginx.conf.docker
@@ -15,10 +15,9 @@ http {
log_format main '$remote_addr -> $request [$status] - '
'referer: $http_referer $http_x_forwarded_for';
access_log /dev/stdout main;
+
server_tokens off;
- sendfile on;
keepalive_timeout 65;
- client_max_body_size 0;
upstream backend {
server __BACKEND__:6666;
@@ -32,6 +31,8 @@ http {
}
location ~ ^/api/(.*)$ {
+ tcp_nodelay on;
+
add_header 'Access-Control-Allow-Origin' '*';
if ($request_method = 'OPTIONS') {
add_header 'Access-Control-Allow-Methods'
@@ -41,29 +42,59 @@ http {
return 200;
}
- if ($request_uri ~* "/api/(.*)") {
- proxy_pass http://backend/$1;
- }
+ client_max_body_size 0;
gzip on;
gzip_comp_level 3;
gzip_min_length 20;
gzip_proxied expired no-cache no-store private auth;
gzip_types text/plain application/json;
+
+ if ($request_uri ~* "/api/(.*)") {
+ proxy_pass http://backend/$1;
+ }
+
+ error_page 500 502 503 504 @badproxy;
}
location /data/ {
rewrite ^/data/(.*) /$1 break;
root /data;
+
+ sendfile on;
+ tcp_nopush on;
+ tcp_nodelay on;
+
+ error_page 403 @unauthorized;
+ error_page 404 @notfound;
}
location / {
root /var/www;
try_files $uri /index.htm;
+ sendfile on;
+ tcp_nopush on;
+ tcp_nodelay on;
+
gzip_static on;
gzip_proxied expired no-cache no-store private auth;
}
+
+ location @unauthorized {
+ return 403 "Unauthorized";
+ default_type text/plain;
+ }
+
+ location @notfound {
+ return 404 "Not Found";
+ default_type text/plain;
+ }
+
+ location @badproxy {
+ return 502 "Failed to connect to szurubooru REST API";
+ default_type text/plain;
+ }
}
}

© 2015 - 2026 Jakob L. Kreuze