Explorar el Código

providing nginx config example for subpath

Rodja Trappe hace 2 años
padre
commit
3140c9563d
Se han modificado 2 ficheros con 72 adiciones y 0 borrados
  1. 13 0
      examples/nginx_subpath/docker-compose.yml
  2. 59 0
      examples/nginx_subpath/nginx.conf

+ 13 - 0
examples/nginx_subpath/docker-compose.yml

@@ -0,0 +1,13 @@
+version: "3.9"
+services:
+  app:
+    image: zauberzeug/nicegui:latest
+    ports:
+      - "3000:8080"
+
+  proxy:
+    image: nginx:1.16.0-alpine
+    ports:
+      - "80:80"
+    volumes:
+      - ./nginx.conf:/etc/nginx/nginx.conf

+ 59 - 0
examples/nginx_subpath/nginx.conf

@@ -0,0 +1,59 @@
+
+user  nginx;
+worker_processes  auto;
+
+error_log  /var/log/nginx/error.log warn;
+pid        /var/run/nginx.pid;
+
+
+events {
+    worker_connections  1024;
+}
+
+
+http {
+
+    include       /etc/nginx/mime.types;
+    default_type  application/octet-stream;
+
+    log_format upstreamlog '[$time_local] $remote_addr - $remote_user - $server_name to: $upstream_addr: $request upstream_response_time $upstream_response_time msec $msec request_time $request_time';
+
+    access_log  /var/log/nginx/access.log upstreamlog;
+    error_log /var/log/nginx/error.log;
+
+    sendfile on;
+    tcp_nopush on;
+    tcp_nodelay on;
+    keepalive_timeout 65;
+    types_hash_max_size 2048;
+
+    ssl_protocols TLSv1 TLSv1.1 TLSv1.2; # Dropping SSLv3, ref: POODLE
+    ssl_prefer_server_ciphers on;
+
+    client_max_body_size 200M;
+
+    map $http_upgrade $connection_upgrade {
+        default upgrade;
+        '' close;
+    }
+
+    server {
+        listen 80 default_server;
+        server_name _;
+
+        location ~ ^/nicegui/(.*)$ {
+            proxy_http_version 1.1;
+            proxy_set_header Upgrade $http_upgrade;
+            proxy_set_header Connection $connection_upgrade;
+            proxy_set_header Authorization $http_authorization;
+            proxy_pass_header  Authorization;
+
+            proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
+            proxy_set_header Host $host;
+            proxy_read_timeout 86400;
+
+            proxy_pass http://app:8080/$1?$args;
+            proxy_set_header X-Forwarded-Prefix /nicegui/$1/;
+        }
+    }
+}