zoukankan      html  css  js  c++  java
  • centos7 安装 certbot 动态更新Let's encrypt 证书实现nginx免费ssl证书

    先更新内核,然后安装nginx。启用bbr。

    yum install yum-plugin-copr
    yum copr enable @caddy/caddy
    yum install caddy
    sudo yum install snapd
    sudo systemctl enable --now snapd.socket
    sudo yum install epel-release
    sudo yum install snapd
    sudo systemctl enable --now snapd.socket
    sudo snap install core; sudo snap refresh core
    reboot
    sudo snap install core; sudo snap refresh core
    sudo snap install core
    snap install core
     systemctl enable snapd
    systemctl start --now snapd.socket
    snap install core
    snap refresh core
    snap install --classic certbot
    ln -s /var/lib/snapd/snap /snap
    snap install --classic certbot
    ln -s /snap/bin/certbot /usr/bin/certbot
    certbot --nginx
    firewall-cmd --permanent --add-port=443/tcp
    firewall-cmd --reload
    yum install yum-plugin-copr
    yum copr enable @caddy/caddy
    yum install caddy
    sudo yum install snapd
    sudo systemctl enable --now snapd.socket
    sudo yum install epel-release
    sudo yum install snapd
    sudo systemctl enable --now snapd.socket
    sudo snap install core; sudo snap refresh core
    reboot
    sudo snap install core; sudo snap refresh core
    sudo snap install core
    snap install core
     systemctl enable snapd
    systemctl start --now snapd.socket
    snap install core
    snap refresh core
    snap install --classic certbot
    ln -s /var/lib/snapd/snap /snap
    snap install --classic certbot
    ln -s /snap/bin/certbot /usr/bin/certbot
    certbot --nginx
    firewall-cmd --permanent --add-port=443/tcp
    firewall-cmd --reload

    安装完毕后,配置nginx即可:

    vim /etc/nginx/conf.d/default.conf

    在server一节配置如下:

        location / {
            try_files $uri $uri/ =404;
            #root   /usr/share/nginx/html;
            #index  index.html index.htm;
        }
        location /your_v2_url_path {
                    proxy_redirect off;
                    proxy_pass http://127.0.0.1:your_v2_port;
                    proxy_http_version 1.1;
                    proxy_set_header Upgrade $http_upgrade;
                    proxy_set_header Connection "upgrade";
                    # Show realip in v2 access.log
                    proxy_set_header X-Real-IP $remote_addr;
                    proxy_set_header Host $host;
                    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        }

    就可以实现你想要的功能了,enjoy~~~

  • 相关阅读:
    vue ui 命令使用
    vue环境搭建
    简版的电商项目学习——第四步:从数据库获取数据,页面跳转以及跳转页面成功与否的提示信息设置
    简版的电商项目学习——第三步:数据库创建,注册功能实现以及用户密码加密
    简版的电商项目学习——第二步:页面布局,以及路由设置
    简版的电商项目学习——第一步:express后台搭建以及基本模块、插件配置
    sass 控制指令
    继承,混合器,占位符的用法 和 sass的数据类型
    ruby 安装 和 sass入门
    大数乘法,分治O(n^1.59)
  • 原文地址:https://www.cnblogs.com/sixiweb/p/14067497.html
Copyright © 2011-2022 走看看