diff --git a/nginx/yuheng.docker.conf b/nginx/yuheng.docker.conf new file mode 100644 index 0000000..bcf87be --- /dev/null +++ b/nginx/yuheng.docker.conf @@ -0,0 +1,41 @@ +# 供 docker-compose 中 nginx 使用:仅监听 443,反代到 api/web/admin;证书挂载到 /etc/ssl/yh_web/yuheng.yuxindazhineng.com/ + +server { + listen 443 ssl http2; + listen [::]:443 ssl http2; + server_name yuheng.yuxindazhineng.com; + + ssl_certificate /etc/ssl/yh_web/yuheng.yuxindazhineng.com/fullchain.pem; + ssl_certificate_key /etc/ssl/yh_web/yuheng.yuxindazhineng.com/privkey.pem; + ssl_session_timeout 1d; + ssl_session_cache shared:SSL:50m; + ssl_protocols TLSv1.2 TLSv1.3; + ssl_ciphers ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384; + + location / { + proxy_pass http://web:80; + proxy_http_version 1.1; + 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; + } + + location /admin/ { + proxy_pass http://admin:80/; + proxy_http_version 1.1; + 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; + } + + location /api/ { + proxy_pass http://api:9527/; + proxy_http_version 1.1; + 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; + } +}