【发布时间】:2019-03-16 08:19:59
【问题描述】:
所以我使用 certbot 为 https 配置 Nginx。效果很好(我使用了自动配置)。
现在如何配置我的 Node.js 后端,以便能够从 Nginx 托管的前端发出 GET/POST 请求?
编辑:
location /api {
proxy_pass http://localhost:3000; #server port
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
proxy_set_header Host $host;
proxy_cache_bypass $http_upgrade;
}
location / {
# First attempt to serve request as file, then
# as directory, then fall back to displaying a 404.
try_files $uri $uri/ =404;
}
【问题讨论】: