Nginx http升级到https
Posted qianjinyan
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Nginx http升级到https相关的知识,希望对你有一定的参考价值。
http和https的区别是
有的网站,http打开的时候,页面提示不安全,比如你点击下面的网站http://www.511easy.com/bug/login
怎样才能去掉这个不安全的提示呢? 从http升级到https呗
最终效果看一下:
如果目前有一个网站,要怎么升级为https呢
域名: 511easy.com
有域名了就可以申请免费的ssl证书,如下截图,基于各个Web服务器的证书,我这边用的是nginx
那然后就需要配置nginx.conf的配置了,大概就是用下面的第三个,前两个是我用来保存的。
https和http相比,更加安全,不尽然,用jmeter/charles/wireshark/fiddle等,生成一个证书,对https的网站都能进行轻易的抓包
upstream tomcatserver1
server 127.0.0.1:8083;
upstream tomcatserver2
server 127.0.0.1:8085;
server
listen 80;
server_name 511easy.com;
location /
proxy_pass http://tomcatserver1;
index index.html index.htm;
server
listen 80;
server_name 511easy.com;
location /
proxy_pass http://tomcatserver2;
index index.html index.htm;
worker_processes 1;
events
worker_connections 1024;
http
include mime.types;
default_type application/octet-stream;
sendfile on;
keepalive_timeout 65;
server
listen 80;
server_name 88bugs;
location /
proxy_pass http://localhost:8083;
server
listen 80;
server_name jenkins;
location /
proxy_pass http://localhost:8080;
worker_processes 1;
events
worker_connections 1024;
http
include mime.types;
default_type application/octet-stream;
sendfile on;
keepalive_timeout 65;
server
listen 443 ssl;
server_name www.511easy.com;
ssl on;
ssl_certificate 1_511easy.com_bundle.crt;
ssl_certificate_key 2_511easy.com.key;
ssl_session_timeout 5m;
location /
proxy_pass http://localhost:8083;
以上是关于Nginx http升级到https的主要内容,如果未能解决你的问题,请参考以下文章
Nginx实战:编译安装,在线升级,实现多域名 http和 https,自动跳转