docker挂载nginx。conf(含ssl,webock
usernginx;16核服务器workerprocesses16;errorlogvarlognginxerror。logwarn;pidvarrunnginx。pid;events{最大链接Linux最大句柄数workerconnections65535;}http{includeetcnginxmime。types;defaulttypeapplicationoctetstream;logformatmainremoteaddrremoteuser〔timelocal〕requeststatusbodybytessenthttprefererhttpuseragenthttpxforwardedfor;accesslogvarlognginxaccess。logmain;sendfileon;tcpnopushon;keepalivetimeout65;gzipon;不包含其他server分离配置直接在下面写includeetcnginxconf。d。conf;upstreamtomcatserver{负载均衡IP和端口server172。21。41。58:9000;}server{listen80;servername域名;clientmaxbodysize200M;locationapi{可支持websocket配置startproxyhttpversion1。1;proxysetheaderUpgradehttpupgrade;proxysetheaderConnectionupgrade;proxyreadtimeout43200s;可支持websocket配置endproxysetheaderHosthost;proxysetheaderXRealIPremoteaddr;proxysetheaderREMOTEHOSTremoteaddr;proxysetheaderXForwardedForhttpxforwardedfor;后端服务器,具体配置upstream部分即可proxypasshttp:tomcatserverapi;}默认静态文件路径location{rootusrsharenginxhtml;indexindex。htmlindex。htm;}}server{listen443ssl;servername域名;clientmaxbodysize200M;sslcertificateetcnginxssl证书。crt;sslcertificatekeyetcnginxssl证书。key;locationapi{可支持websocket配置startproxyhttpversion1。1;proxysetheaderUpgradehttpupgrade;proxysetheaderConnectionupgrade;proxyreadtimeout43200s;可支持websocket配置endproxysetheaderHosthost;proxysetheaderXRealIPremoteaddr;proxysetheaderREMOTEHOSTremoteaddr;proxysetheaderXForwardedForhttpxforwardedfor;后端服务器,具体配置upstream部分即可proxypasshttp:tomcatserverapi;}location{默认静态文件路径rootusrsharenginxhtml;indexindex。htmlindex。htm;}}
学习笔记,仅供参考