48 location ^~ /bgmonitor/ {
50 proxy_pass http://localhost:8080/;
51 }
Requests in the form of www.mr.org/bgmonitor are forwarded to the local tomcat on port 8080
<Context docBase="/Users/mr/Documents/code_pool/bgmonitor-git/bgmonitor-web/target/bgmonitor" path="" reloadable="true"/>
<!-- bootstrap 3.0.2 -->
<link href="${rc.contextPath}/css/bootstrap.css" rel="stylesheet" type="text/css"/>
<!-- font Awesome -->
<link href="${rc.contextPath}/css/font-awesome.min.css" rel="stylesheet" type="text/css"/>
<!-- Ionicons -->
<link href="${rc.contextPath}/css/ionicons.min.css" rel="stylesheet" type="text/css"/>
<!-- Theme style -->
<link href="${rc.contextPath}/css/AdminLTE.css" rel="stylesheet" type="text/css"/>
When accessing, because ${rc.contextPath} is empty, the entire resource path becomes /css/AdminLTE.css. This request cannot be forwarded normally after being sent to nginx
How can I make the entire application work properly with minimal modifications?
Static files do not need to be forwarded. Deploy static files on nginx locally, such as
Specific how to configure the reference document
See the blog for details:
http://blog.iaceob.name/nginx-proxy/
and
http://blog.iaceob.name/tomcat-multi-domain-binding/
This is the solution I use. It’s just my personal use. I haven’t found anyone else who has used it this way.