公司需要将原http的请求转为https,请问我改如何配置
环境如下
域名 oa.baidu.com
公网IP 220.181.57.217
内网IP(Nginx服务器) 10.250.190.80
Tomcat应用服务器1 10.250.190.81(假设运行应用oa)
Tomcat应用服务器2 10.250.190.82(假设运行应用hr)
现在需要通过域名的4430端口访问各个服务器上的web应用
公网的4430端口已经和内网的10.250.190.80做好映射,证书配置也没问题
我应该如何配置
https://oa.baidu.com:4430/oa/
https://oa.baidu.com:4430/hr/以下是我配置的,
server {
listen 443;
charset utf-8;
proxy_redirect off;
server_name oa.baidu.com;
ssl on;
root html;
index index.html index.htm;
ssl_certificate cert/oa_baidu_com.pem;
ssl_certificate_key cert/oa_baidu.com.key;
ssl_session_timeout 5m;
ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:ECDHE:ECDH:AES:HIGH:!NULL:!aNULL:!MD5:!ADH:!RC4;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_prefer_server_ciphers on;
location ^~ /oa/ {
proxy_pass http://10.250.190.81:8080/oa/;
proxy_set_header Host $http_host:$server_port;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_pass_header User-Agent;
}
}配置好后重启nginx服务器后,访问https://oa.baidu.com:4430/oa/,报错如下
但地址发生了变化,http://oa.baidu.com:443/oa/login
我发现https变成了http,4430端口也变成了443端口,不知道哪里设置错了,请求帮助,感激不尽
环境如下
域名 oa.baidu.com
公网IP 220.181.57.217
内网IP(Nginx服务器) 10.250.190.80
Tomcat应用服务器1 10.250.190.81(假设运行应用oa)
Tomcat应用服务器2 10.250.190.82(假设运行应用hr)
现在需要通过域名的4430端口访问各个服务器上的web应用
公网的4430端口已经和内网的10.250.190.80做好映射,证书配置也没问题
我应该如何配置
https://oa.baidu.com:4430/oa/
https://oa.baidu.com:4430/hr/以下是我配置的,
server {
listen 443;
charset utf-8;
proxy_redirect off;
server_name oa.baidu.com;
ssl on;
root html;
index index.html index.htm;
ssl_certificate cert/oa_baidu_com.pem;
ssl_certificate_key cert/oa_baidu.com.key;
ssl_session_timeout 5m;
ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:ECDHE:ECDH:AES:HIGH:!NULL:!aNULL:!MD5:!ADH:!RC4;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_prefer_server_ciphers on;
location ^~ /oa/ {
proxy_pass http://10.250.190.81:8080/oa/;
proxy_set_header Host $http_host:$server_port;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_pass_header User-Agent;
}
}配置好后重启nginx服务器后,访问https://oa.baidu.com:4430/oa/,报错如下
但地址发生了变化,http://oa.baidu.com:443/oa/login
我发现https变成了http,4430端口也变成了443端口,不知道哪里设置错了,请求帮助,感激不尽
解决方案 »
- nginx 怎么响应我post的json数据,总是405
- 修改了linux格式化工具mke2fs的库文件lib/initialize.c这个源文件,如何在makefile中添加包含路径,详细看帖子
- Windows怎么连接DNS服务器实现域名解析?
- 第一次发表文章 配置远程链接centos7
- vm虚拟机安装之后没有网卡,求救啊
- 【求救】win7环境下用vmware安装ubuntu16.04一直卡在这个画面
- 在Linux安装mysql,在scripts目录下执行mysql_install_db --user=mysql,提示未找到命令
- Kernel panic - not syncing:Hard LOCKUP怎么解决?
- 安装凝思操作系统电脑重启就黑屏
- exynos的GPU
- 关于L2TP的连接问题
- Ubuntu升级到17.10然后设置任务栏到底层,然后再打开设置就无法显示设置选项了
----------------- proxy_pass http://10.250.190.81:8080/oa/; 你的oa是8080端口, 而你的监听listen又是配置的443端口
建议你把后端tomcat服务器改成标准80端口
tomcat ssl 默认是8443
http 改成80 https 8443比如现在配置https 在http{
加入
upstream oa{
server 10.250.190.81:8443;
}}
server{
listen 8443 ssl; /根据你自己的外网https端口改,建议内外端口一致
ssl on;
ssl_certificate /opt/soft/sign/xxx.crt;
ssl_certificate_key /opt/soft/sign/xxx.key;
ssl_session_timeout 5m;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_ciphers ALL:!DH:!EXPORT:!RC4:+HIGH:+MEDIUM:-LOW:!aNULL:!eNULL;
ssl_prefer_server_ciphers on;
server_name softphone.loogear.com;
access_log logs/Jsoftphone.access.log main; error_log logs/Jsoftphone.access.log debug; client_header_buffer_size 600k;
large_client_header_buffers 4 600k;
proxy_pass https://oa; 这是上面upstream的名字
proxy_redirect off;
proxy_set_header Host $host:8443;
proxy_set_header real_ip_header X-Real-IP;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Refer $http_referer;
client_max_body_size 20m;
client_body_buffer_size 600k;
proxy_connect_timeout 90;
proxy_send_timeout 90;
proxy_read_timeout 90;
proxy_buffer_size 100k;
proxy_buffers 4 600k;
proxy_busy_buffers_size 600k;
proxy_temp_file_write_size 600k;}你也可以不家upstream,加了是方便以后负载均衡,而且便于书写