让我先说我不知道自己在做什么。
好吧,除此之外,我的问题是:我正在运行 Grunt 的网络服务器来提供前端文件,我正在运行 webrick 来获取数据 api。Grunt 使用 grunt-connect-proxy 代理对 webrick 的数据请求。在开发中,我让 grunt 服务器在端口 9000 上监听,webrick 在端口 3000 上监听。
我想让这个工作流程与 Nginx 一起工作,但我不知道该怎么做......如果有人知道如何设置适当的配置文件,你的帮助将是无价的。
server {
server_name example.com;
location / {
proxy_pass http://127.0.0.1:9000;
proxy_set_header Host $host;
}
}
添加您需要的任何其他规则
访问https://github.com/drewzboto/grunt-connect-proxy。有一步一步的例子。粘贴您的代码。