CentOS 7 上 nginx 使用 CerBot 安装 https 访问 SSL 证书配置

16 篇文章 0 订阅
1 篇文章 0 订阅

安装 CertBot

CentOS 上安装依赖包:

yum install epel-release

安装 CertBot:

cd /root/

wget https://dl.eff.org/certbot-auto --no-check-certificate

chmod +x ./certbot-auto

./certbot-auto -n

生成 SSL Cert 证书

  • 单个域名生成 https 证书
./certbot-auto certonly --email youemail@qatools.cn --agree-tos --no-eff-email --webroot -w /home/wwwroot/www.qatools.cn -d www.qatools.cn

说明:

**—webroot -w **:网站运行的主目录

-d: 网站域名

  • 多个域名证书生成
./certbot-auto certonly --email youemail@qatools.cn --agree-tos --no-eff-email --webroot -w /home/wwwroot/www.qatools.cn -d www.qatools.cn -d books.qatools.cn

Nginx SSL 证书配置

  • Nginx config 文件配置 qatools.cn.conf
server {
        listen       443;
        root /www/web/qatools_cn/public_html;
        ssl                  on;
        ssl_certificate      cert/qatools.cn.pem;
        ssl_certificate_key  cert/qatools.cn.key;
        ssl                  on;
        ssl_prefer_server_ciphers on;
        ssl_session_timeout 10m;
        ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
        ssl_ciphers EECDH+CHACHA20:EECDH+AES128:RSA+AES128:EECDH+AES256:RSA+AES256:EECDH+3DES:RSA+3DES:!MD5;
        server_name qatools.cn www.qatools.cn;
        index index.html;
        error_page  400 /errpage/400.html;
        error_page  403 /errpage/403.html;
        error_page  404 /errpage/404.html;
        error_page  503 /errpage/503.html;
        location ~ \.php$ {
                proxy_pass http://127.0.0.1:88;
                include naproxy.conf;
        }
        location ~ /\.ht {
	            deny  all;
	    }
        location / {
                try_files $uri @apache;
        }
        location @apache {
                 internal;
                 proxy_pass http://127.0.0.1:88;
                 include naproxy.conf;
        }
}
  • Nginx 重新启动或重新加载 conf 文件

    重载 conf 文件

nginx -s reload

重启 ngin x

service nginx restart
  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值