From b6d8c479f3164515bc16931a9c9deb6039f2c518 Mon Sep 17 00:00:00 2001 From: asari <32879431+deomorxsy@users.noreply.github.com> Date: Mon, 22 Jul 2024 14:29:55 -0300 Subject: [PATCH] fix: improve nginx.conf, change compose port --- compose.yml | 2 +- nginx.conf | 57 ++++++++++++++++++++++++++++++++--------------------- 2 files changed, 36 insertions(+), 23 deletions(-) diff --git a/compose.yml b/compose.yml index 305ab36..c20277c 100644 --- a/compose.yml +++ b/compose.yml @@ -19,7 +19,7 @@ services: nginx: image: nginx:1.25.4-alpine ports: - - "8083:80" + - "8083:443" volumes: - ./nginx.conf:/etc/nginx/nginx.conf # diff --git a/nginx.conf b/nginx.conf index 2fa03c0..4c4ca11 100644 --- a/nginx.conf +++ b/nginx.conf @@ -1,29 +1,42 @@ -include /etc/nginx/mime.types; +worker_processes 1; -server { - # ipv4 - listen 443 ssl; - # ipv6 - listen [::]:443 ssl; - server_name ${gh_user}.github.io/${repo_subdir}; +events { + worker_events 1024; +} - types { - application/wasm wasm; - } +http { + include /etc/nginx/mime.types; + default_type application/octet-stream; + sendfile on; + keepalive_timeout 65; + gzip on; - # yew-rs frontend - location / { + server { + # + listen 443 ssl; # ipv4 + listen [::]:443 ssl; # ipv6 + server_name ${gh_user}.github.io/${repo_name}; + # + # yew-rs frontend root ./client/dist/index.html; - try_files $uri $uri/ ./client/index.html; - include /etc/nginx/mime.types; - default_type application/octet-stream; - } - # SpringBoot backend - location /api { - proxy_pass http://localhost:8080; - proxy_set_header X-Real-IP $remote_addr; - proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; - proxy_set_header Host $http_host; + location / { + proxy_pass http:// + try_files $uri $uri/ ./client/index.html; + include /etc/nginx/mime.types; + types { + application/wasm wasm; + } + + default_type application/octet-stream; + } + # + # SpringBoot backend + location /api { + proxy_pass http://localhost:8080; + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_set_header Host $http_host; + } } }