服务器 2019-09-03 16:49:08

1.nginx代理后,request.origin与预期不符

问题:

koa,request.origin获取到http://localhost:9080; 希望获取到的是当前域名

解决方法

nginx配置中location新增 proxy_set_header Host $host;

location / { #root html; #index index.html index.htm; proxy_pass http://localhost:9080; proxy_set_header Host $host; }

2.403forbidden

修改nginx user为目录权限用户

3.nginx分割站点配置文件

随着主机上部署的服务越来越多,nginx.conf内容过多,需要拆分 创建servers目录,通过include引入其他站点配置文件

include ./servers/*;