免费申请SSL证书+nginx反向代理域名访问

1 申请免费的SSL站点安全认证证书

1.1 FreeSSL.org 提供免费的SSL

  • 访问地址:https://freessl.cn/

1.2 如图所示给自己域名创建免费的SSL证书

免费申请SSL证书+nginx反向代理域名访问_第1张图片

 

1.3 提供自己邮箱点击创建

免费申请SSL证书+nginx反向代理域名访问_第2张图片

1.4 我的服务器是华为云,在华为云添加DNS记录集

1.4.1 FressSSL创建完成会提供DNS验证

免费申请SSL证书+nginx反向代理域名访问_第3张图片

1.4.2 在华为云添加DNS记录集,然后返回FressSSL页面验证,随即下载证书

免费申请SSL证书+nginx反向代理域名访问_第4张图片

2 Nginx 反向代理站点域名和SSL认证

2.1 进入nginx安装目录

  • [root@localhost ~]# cd /usr/local/nginx

2.3 向服务器上传申请下来的SSL证书

  • [root@localhost  nginx]# rz

       

2.4 配置nginx.conf 文件

  • [root@localhost  nginx]# vim nginx.conf

# baihoo 2019-1-12 添加
# nginx 配置 http 强转 https
server {
   
listen 80 default_server;
   
listen [::]:80 default_server;
   
server_name www.chenbaihoo.com;
   
return 301 https://$server_name$request_uri;
}

# // baihoo 2019-1-12 添加
server {
   
listen       80;
   
# baihoo 2019-1-12 修改
    listen       443 ssl;
   
# 服务名值替换成自己的域名
    server_name  www.chenbaihoo.com;
   
# //baihoo 2019-1-12 修改
    # baihoo 2019-1-12 添加
    # ssl 认证配置
    ssl_certificate      full_chain.pem;
   
ssl_certificate_key  private.key;
   
ssl_session_cache    shared:SSL:1m;
   
ssl_session_timeout  5m;
   
ssl_ciphers  HIGH:!aNULL:!MD5;
   
ssl_prefer_server_ciphers  on;
   
# //baihoo 2019-1-12 添加
    #charset koi8-r;
    #access_log  logs/host.access.log  main;
   
location / {
   
# baihoo 2019-1-12 修改
        #root   html;
        #index  index.html index.htm;
        #
添加代理访问路径
        proxy_pass http://ip:8080/;
   
# // baihoo 2019-1-12 修改
    }
   
......
}                                                                                                                                                                                                                                                                                                                                                                                                                                        

 

你可能感兴趣的:(Linux,Java进阶)