docker compose added nginx revert proxy to port 80
This commit is contained in:
parent
f98aaf323d
commit
27e2ee184a
@ -28,4 +28,15 @@ services:
|
||||
ports:
|
||||
- "5173:5173"
|
||||
|
||||
restart: always
|
||||
restart: always
|
||||
|
||||
nginx:
|
||||
image: nginx:latest
|
||||
depends_on:
|
||||
- backend
|
||||
- frontend
|
||||
ports:
|
||||
- "80:5173"
|
||||
network_mode: host
|
||||
volumes:
|
||||
- ./nginx.conf:/etc/nginx/nginx.conf # 挂载自定义的nginx配置文件
|
||||
|
||||
25
nginx.conf
Normal file
25
nginx.conf
Normal file
@ -0,0 +1,25 @@
|
||||
events {}
|
||||
|
||||
http {
|
||||
|
||||
upstream backend {
|
||||
least_conn;
|
||||
server localhost:5173;
|
||||
server localhost:5173;
|
||||
}
|
||||
|
||||
server {
|
||||
listen 80;
|
||||
|
||||
location / {
|
||||
proxy_pass http://backend;
|
||||
proxy_set_header Host $host;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_set_header X-Forwarded-Proto $scheme;
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user