我有一个配置了serverpilot的云服务器。我在其中创建了一个新的应用程序,并设置了一个监听8080的tomcat。如果我使用域名:8080,我就可以访问tomcat。现在我想修改nginx反向代理,使其在端口80上工作。
我尝试修改的文件:
/etc/nginx-sp/vhosts.d/wfm.d/main.conf
现有代码
location /{
proxy_pass $backend_protocol://$backend_host:$backend_port;
}我添加了一个新的:
location /{
proxy_pass http://127.0.0.1/wfm:8080;
}在那之后我重启了我的nginx,但它不工作,浏览器页面继续加载,最后超时。
发布于 2016-08-03 01:12:22
使用ServerPilot向非PHP应用程序发送请求的方法不是对Nginx进行任何定制,而是对use a .htaccess file to proxy requests to the port your app is listening on.进行定制。
您的.htaccess文件将如下所示:
RewriteRule index.html http://localhost:8080/ [P]
RewriteRule (.*) http://localhost:8080/$1 [P]https://stackoverflow.com/questions/38712808
复制相似问题