nginx front end https +tomcat back end http non-80/443 port reverse proxy configuration

http://blog.csdn.net/xzknet/article/details/22672127  (Nginx proxy non-80 port) 

 

 

Front-end nginx https +tomcat http non-80 port configuration

Nginx adds the following configuration

proxy_set_header Host $host:$server_port; not port 80, $server_port is not required when using port 80

proxy_set_header X-Real-IP $remote_addr;

proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;

proxy_set_header X-Forwarded-Proto $scheme;

 

Tomcat server.xml configuration

 <Engine name="Catalina" defaultHost="localhost">

      <Valve className="org.apache.catalina.valves.RemoteIpValve"

             remoteIpHeader="X-Forwarded-For"

             protocolHeader="X-Forwarded-Proto"

             protocolHeaderHttpsValue="https" httpsServerPort="7001"/> When the port is not 80, the httpsServerPort configuration must be added, otherwise the request.getServerPort() method returns 443.

</Engine>

 

 

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326540159&siteId=291194637