|
|
|
|
@ -1,27 +1,32 @@
|
|
|
|
|
server {
|
|
|
|
|
listen 80;
|
|
|
|
|
server_name glucowise.site www.glucowise.site;
|
|
|
|
|
|
|
|
|
|
root /var/www/glucowise;
|
|
|
|
|
index index.html;
|
|
|
|
|
|
|
|
|
|
# Let's Encrypt验证目录
|
|
|
|
|
location /.well-known/acme-challenge/ {
|
|
|
|
|
root /var/www/glucowise;
|
|
|
|
|
allow all;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
# 临时允许HTTP访问(申请证书后会重定向到HTTPS)
|
|
|
|
|
server_name 1.92.111.107;
|
|
|
|
|
|
|
|
|
|
# 前端静态文件
|
|
|
|
|
location / {
|
|
|
|
|
root /var/www/glucowise;
|
|
|
|
|
index index.html;
|
|
|
|
|
try_files $uri $uri/ /index.html;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
# 后端API代理
|
|
|
|
|
|
|
|
|
|
# API代理到后端
|
|
|
|
|
location /api/ {
|
|
|
|
|
proxy_pass http://127.0.0.1:8080;
|
|
|
|
|
proxy_pass http://localhost:8080;
|
|
|
|
|
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;
|
|
|
|
|
|
|
|
|
|
# 超时设置
|
|
|
|
|
proxy_connect_timeout 30s;
|
|
|
|
|
proxy_send_timeout 30s;
|
|
|
|
|
proxy_read_timeout 30s;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
# 上传文件访问
|
|
|
|
|
location /uploads/ {
|
|
|
|
|
alias /opt/glucowise/uploads/;
|
|
|
|
|
expires 1y;
|
|
|
|
|
add_header Cache-Control "public";
|
|
|
|
|
}
|
|
|
|
|
}
|