Skip to content

Commit

Permalink
fix: improve nginx.conf, change compose port
Browse files Browse the repository at this point in the history
  • Loading branch information
deomorxsy committed Jul 22, 2024
1 parent 3b9f92e commit b6d8c47
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 23 deletions.
2 changes: 1 addition & 1 deletion compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ services:
nginx:
image: nginx:1.25.4-alpine
ports:
- "8083:80"
- "8083:443"
volumes:
- ./nginx.conf:/etc/nginx/nginx.conf
#
Expand Down
57 changes: 35 additions & 22 deletions nginx.conf
Original file line number Diff line number Diff line change
@@ -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;

}
}
}

0 comments on commit b6d8c47

Please sign in to comment.