nginx https反向代理 tomcat

时间:2021-07-19 16:42:10

前端nginx配置

  server {
listen ;
server_name localhost; listen ssl;
ssl_certificate /usr/local/nginx/sslkey/xxxxxx.pem;
ssl_certificate_key /usr/local/nginx/sslkey/xxxxxxxx.key;
#charset koi8-r; #access_log logs/host.access.log main; location / {
proxy_pass http://xxx;
proxy_buffers 1024k;
proxy_pass_header Server;
proxy_set_header Host $http_host;
proxy_set_header X-Forwarded-Proto https;
proxy_set_header X-Real-IP $remote_addr;
}

后端tomcat 配置

 <Connector port="" protocol="HTTP/1.1"
connectionTimeout=""
uRIEncoding="utf-8"
redirectPort=""
proxyPort=''/>
       <Host appBase="webapps" autoDeploy="true" name="localhost" unpackWARs="true">
<!-- SingleSignOn valve, share authentication between web applications
Documentation at: /docs/config/valve.html -->
<!--
<Valve className="org.apache.catalina.authenticator.SingleSignOn" />
--> <Valve className="org.apache.catalina.valves.RemoteIpValve"
remoteIpHeader="x-forwarded-for"
remoteIpProxiesHeader="x-forwarded-by"
protocolHeader="x-forwarded-proto" /> <!-- Access log processes all example.

END!