- server {
- # listen 80; // 如果开启 443,80 最好关掉
- listen 443 ssl;
- ssl_certificate /etc/nginx/conf.d/ssl/server.crt; // 公私钥加载位置
- ssl_certificate_key /etc/nginx/conf.d/ssl/server.key;
- server_name localhost;
- access_log /var/log/nginx/syncSign_web.access.log;
- error_log /var/log/nginx/syncSign_web.error.log;
- location / {
- root /root/build_dhFront;
- index index.html;
- try_files $uri $uri/ /index.HTML;
- }
- // 将所有 API 接口的请求直接代理到本地 8088 端口, 前端 JS 项目中不需要填写 IP 和 port
- location /API/ {
- proxy_pass http://127.0.0.1:8088;
- }
- }
用到的 https 自签名证书的生成方式:
https://www.cnblogs.com/sunkaikees/p/10273897.html
来源: http://www.bubuko.com/infodetail-2922380.html