server { listen 80; server_name api.txyundm.cn; location /.well-known/acme-challenge/ { root /var/www/certbot; } location / { return 301 https://$host$request_uri; } } server { listen 443 ssl http2; server_name api.txyundm.cn; ssl_certificate /etc/letsencrypt/live/api.txyundm.cn/fullchain.pem; ssl_certificate_key /etc/letsencrypt/live/api.txyundm.cn/privkey.pem; client_max_body_size 20m; access_log /var/log/nginx/qipai-api.access.log; error_log /var/log/nginx/qipai-api.error.log; location /app-api/ { proxy_pass http://127.0.0.1:3000/app-api/; 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-api/ { proxy_pass http://127.0.0.1:3000/admin-api/; 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 /uploads/ { alias /opt/apps/uploads/; autoindex off; } location /admin/ { alias /opt/apps/qipai-admin/dist/; try_files $uri $uri/ /admin/index.html; } location = /health { return 200 "ok\n"; add_header Content-Type text/plain; } }