nginx反向代理tomcat

tomcat的serve.xml配置信息

<Host name="localhost" appBase=""
unpackWARs="true" autoDeploy="true">

<Valve className="org.apache.catalina.valves.AccessLogValve" directory="logs"

prefix="localhost_access_log" suffix=".txt"
pattern="%h %l %u %t &quot;%r&quot; %s %b" />
<Context docBase="xxx.war" path="" reloadable="true" source="org.eclipse.jst.jee.server:test"/>

</Host>

 

nginx的配置文件

upstream tomcat{
  server localhost:8080;
}

server{
  listen 80;
  server_name jsp_test.fyiyy.cn;
  charset utf-8;
  root /home/www/jsp_test;
  location / {
    proxy_pass http://tomcat;
    index index.jsp index.jspx index.do;
    proxy_set_header X-Forworded-Host $host;
    proxy_set_header X-Forwarded-Server $host;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
  }
}

posted @ 2021-01-13 21:35  程序员小艺  阅读(130)  评论(0编辑  收藏  举报