Nginx+Tomcat 7 to support SSL(HTTPS)
来源:互联网 发布:淘宝的店铺号在哪里看 编辑:程序博客网 时间:2024/06/03 14:53
要让Nginx+Tomcat7支持SSL,配置可以参考官方的相关文档,比如Tomcat7的:http://tomcat.apache.org/tomcat-7.0-doc/ssl-howto.html
1:: 证书
1)创建保存证书的目录:mkdir -p /usr/local/ssl
2) 生成证书:
# cd /usr/local/ssl
# openssl genrsa -des3 -out server.key 1024
# openssl req -new -key server.key -out server.csr
# cp server.key server.key.org
# openssl rsa -in server.key.org -out server.key
# openssl rsa -in server.key -out server.pem
# openssl x509 -req -days 365 -in server.csr -signkey server.key -out server.crt
2:: 修改配置文件
1)修改Tomcat7的$TOMCAT7_HOME$/conf/server.xml
<Connector protocol="HTTP/1.1"
port="8443" maxThreads="2000"
scheme="https" secure="true" SSLEnabled="true"
SSLCertificateFile="/usr/local/ssl/kbserver.crt"
SSLCertificateKeyFile="/usr/local/ssl/kbserver.pem"
SSLVerifyClient="optional" SSLProtocol="TLSv1"/>
2)修改Nginx的配置文件$NGINX_HOME$nginx.conf
server {
listen 443;
server_name localhost:8443;
ssl on;
ssl_certificateserver.crt;
ssl_certificate_key server.key;
ssl_session_timeout 5m;
location / {
proxy_pass https://localhost:8443;
proxy_set_header Host $host:443;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Via "nginx";
}
}
3:: 重启Nginx和Tomcat7服务
4:: 参考
http://blog.nicknett.com/2011/09/configuring-tomcat-7-to-support-ssl.html
- Nginx+Tomcat 7 to support SSL(HTTPS)
- Nginx SSL+Tomcat https
- configuring tomcat to support SSL
- Nginx(Https) + Tomcat 启用 Https(SSL) 支持
- 【安全】 详解 Nginx + Tomcat HTTPS/SSL 配置
- 详解 Nginx + Tomcat HTTPS/SSL 配置方法
- 详解 Nginx + Tomcat HTTPS/SSL 配置方法
- Nginx+Tomcat+SSL 识别 https还是http
- 详解 Nginx + Tomcat HTTPS/SSL 配置
- 详解 Nginx + Tomcat HTTPS/SSL 配置
- 详解 Nginx + Tomcat HTTPS/SSL 配置方法
- 详解 Nginx + Tomcat HTTPS/SSL 配置
- 阿里云ssl tomcat nginx https
- https Connector SSL Support
- nginx ssl tomcat no ssl https http问题
- tomcat配置https以及nginx使用ssl模块配置HTTPS
- Nginx + Tomcat HTTPS/SSL 配置方法 ——申请证书
- nginx反向代理tomcat的ssl(https)实现
- C++指针解惑(不断学习补充中)
- JavaScript删除确认代码,判断checkbox是否被选中代码
- 收藏几个学习的网站
- HTTP无状态理解
- mybatis之类似级联功能的使用
- Nginx+Tomcat 7 to support SSL(HTTPS)
- 大数据量高并发的 数据库优化
- DoDataExchange 简述
- aspx 页面弹出窗口代码大全
- D3D中的Alpha颜色混合(1)
- GetCurrentDirectory和SetCurrentDirectory函数
- GLib介绍与使用
- [计算机基础]线程安全
- Java IO流分析整理