用户工具

站点工具


setup_https_with_nginx_and_letsencrypt

差别

这里会显示出您选择的修订版和当前版本之间的差别。

到此差别页面的链接

两侧同时换到之前的修订记录前一修订版
后一修订版
前一修订版
setup_https_with_nginx_and_letsencrypt [2018/01/15 10:27] jiajisetup_https_with_nginx_and_letsencrypt [2024/02/04 04:49] (当前版本) – 外部编辑 127.0.0.1
行 1: 行 1:
 +## 使用Letsencrypt 配置https
 +
 注意:以下都是以ubuntu 16.04 环境为例子, 默认安装好了nginx 注意:以下都是以ubuntu 16.04 环境为例子, 默认安装好了nginx
  
行 30: 行 32:
 ``` ```
  
-===== nginx 80 和443的配置文件 =====+ 
 +===== 配置nginx的 http 和https跳转=====
  
 ``` ```
行 37: 行 40:
        listen [::]:443 ssl http2;        listen [::]:443 ssl http2;
  
-        ssl_certificate /etc/letsencrypt/live/maoyouhui.cc/fullchain.pem; +        ssl_certificate /etc/letsencrypt/live/<xxx>.com/fullchain.pem; 
-        ssl_certificate_key /etc/letsencrypt/live/maoyouhui.cc/privkey.pem;+        ssl_certificate_key /etc/letsencrypt/live/<xxx>.com/privkey.pem;
         ssl_dhparam         /etc/nginx/ssl/dhparam.pem;         ssl_dhparam         /etc/nginx/ssl/dhparam.pem;
  
-        server_name maoyouhui.cc www.maoyouhui.cc+        server_name <xxx>.com www.<xxx>.com
- root /www/wwwroot/maoyouhui.cc;+ root /www/<xxx-path>;
  
         location / {         location / {
行 52: 行 55:
        listen         80;        listen         80;
        listen    [::]:80;        listen    [::]:80;
-       server_name    maoyouhui.cc www.maoyouhui.cc;+       server_name <xxx>.com www.<xxx>.com;
        return         301 https://$server_name$request_uri;        return         301 https://$server_name$request_uri;
 } }
 +```
 +
 +===== 添加新域名到已有证书下 =====
 +
 +```
 +certbot certonly --cert-name example.com -d m.example.com,www.m.example.com
 ``` ```
  
setup_https_with_nginx_and_letsencrypt.1516012074.txt.gz · 最后更改: (外部编辑)