A-A+

Tengine(Nginx)配置SSL(https)

2017年01月13日 Ssl 暂无评论 阅读 368 次浏览 次
要点:如果系统是内部用,可以通过openssl生成证书,只是访问的时候,浏览器会提示不信任,
 
 
 
1、生成证书,创建存放证书的目录/home/sslkey,并进入该目录,输入如下命令,按照提示填写相关的注册信息,完成后,会生成web.key、web.csr、web.key.org、web.crt这几个文件
 
openssl genrsa -des3 -out web.key 2048
openssl req -new -key web.key -out web.csr
cp web.key web.key.org
openssl rsa -in web.key.org -out web.key
openssl x509 -req -days 365 -in web.csr -signkey web.key -out web.crt
 
 
 
2、配置nginx.conf,在文件的最下边,把默认注释的https配置的“#”去掉,修改:
 
ssl_certificate      /home/sslkey/web.crt;
ssl_certificate_key  /home/sslkey/web.key;

location / {
            proxy_pass http://应用服务器IP(Tomcat):端口;
            root html;
            index index.html index.htm;
}
 
 
 
 
3、完成
 
 
 
附录:
 
使用.pfx .p12证书
 
openssl pkcs12 -in /usr/local/nginx/ssl/xxx.pfx -clcerts -nokeys -out /usr/local/nginx/ssl/xxx.crt
 
openssl pkcs12 -in /usr/local/nginx/ssl/xxx.pfx -nocerts -nodes -out /usr/local/nginx/ssl/xxx.rsa
 
 

评论已关闭!

Copyright © 香港虚拟主机_美国虚拟主机_香港服务器_美国服务器租用托管 保留所有权利.   Theme  Ality 蜀ICP备14006632号-1

用户登录