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

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

1.1 FreeSSL.org 提供免费的SSL

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

 

1.3 提供自己邮箱点击创建

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

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

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

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 修改
    }
   
......
}                                                                                                                                                                                                                                                                                                                                                                                                                                        

 

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值