nginx+tomcat非80或者443端口跳转解决方法


protocol="org.apache.coyote.http11.Http11NioProtocol"
connectionTimeout="20000"
redirectPort="8443"
acceptorThreadCount="2"
acceptCount="2048"
maxThreads="400"
processorCache="400"
proxyPort="9980"
proxyName="bjdev.halodigit.com"
scheme="https"
/>

路径转换nginx

location /h5/pay {
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_pass http://iapppayh5.iapppay.com.domain;
proxy_redirect http://web.xx.com https://web.xx.com:10006;


nginx常见配置

upstream pcbjdev.tes.com{
server 127.0.0.1:23476;

}

upstream pubtestbjdev.tes.com{
server 127.0.0.1:23481;

}

upstream h5bjdev.tes.com{
server 127.0.0.1:23470;

}

upstream baidubjdev.tes.com{
server 192.168.1.210:23550;

}

server {
listen 6443;
server_name bjdev.tes.com;

error_log /home/nginx/ssl_nginx/logs/ssl_error.log debug;
access_log /home/nginx/ssl_nginx/logs/ssl_access.log main;

ssl on;
ssl_certificate /home/nginx/ssl_nginx/conf/conf.d/cert_ssl/tes.pem;
ssl_certificate_key /home/nginx/ssl_nginx/conf/conf.d/cert_ssl/tes.key.unsecure;
ssl_session_timeout 5m;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_ciphers ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES256-SHA384:ECDHE-RSA-AES256-SHA384:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA256:ECDHE-ECDSA-RC4-SHA:!ECDHE-RSA-RC4-SHA:ECDH-ECDSA-RC4-SHA:ECDH-RSA-RC4-SHA:ECDHE-RSA-AES256-SHA:!RC4-SHA:HIGH:!aNULL:!eNULL:!LOW:!3DES:!MD5:!EXP:!CBC:!EDH:!kEDH:!PSK:!SRP:!kECDH;
ssl_session_cache shared:SSL:20m;
# ssl_stapling on;
# ssl_stapling_verify on;
ssl_prefer_server_ciphers on;
port_in_redirect off;


location = /favicon.ico {
log_not_found off;
access_log off;
}

location ~ \.(js|css|jpg|jpeg|png|ico|html|gif)$ {
root /home/TEST/iapppay/static-resources;
#root /home/nginx/nginx/static-resources;
}

location /pc/ {
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_pass http://pcbjdev.tes.com;
}

location /h5/ {
limit_except GET POST HEAD {
deny all;
}
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_pass http://h5bjdev.tes.com;
}

location /test/ {
limit_except GET POST HEAD {
deny all;
}
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_pass http://h5bjdev.tes.com;
}

location /baidu/ {
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_pass http://baidubjdev.tes.com;
}

location /api/baidu/ {
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_pass http://baidubjdev.tes.com;
}

location /pubtest/ {
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_pass http://pubtestbjdev.tes.com;
}
}

你可能感兴趣的:(负载均衡)