CentOS7 配置Nginx支持HTTPS訪問(wèn)的實(shí)現(xiàn)方案
CentOS7配置Nginx支持HTTPS訪問(wèn)
1.安裝git和bc
yum -y install git bc
2.安裝Nginx
1.準(zhǔn)備:
yum install -y gcc-c++ pcre pcre-devel zlib zlib-devel openssl openssl-devel
2.下載:
wget https://nginx.org/download/nginx-1.11.6.tar.gz
3.解壓:
tar zxvf nginx-1.11.6.tar.gz
4.編譯安裝:
cd nginx-1.11.6 ./configure --with-ipv6 --with-http_ssl_module make make install
3.申請(qǐng)SSL證書(shū)
1.下載Let's Encrypt
git clone https://github.com/wjg1101766085/certbot.git
2.運(yùn)行Let's Encrypt
cd certbot ./letsencrypt-auto
生成文件:
cert.pem: 域名證書(shū)
chain.pem: The Let's Encrypt 證書(shū)
fullchain.pem: 上面兩者合體
privkey.pem: 證書(shū)密鑰
4.配置Nginx
1.修改nginx.conf文件
nano /usr/local/nginx/conf/nginx.conf 添加: ssl_certificate /etc/letsencrypt/live/域名/fullchain.pem; ssl_certificate_key /etc/letsencrypt/live/域名/privkey.pem; 修改: server_name 域名;
5.自動(dòng)續(xù)簽證書(shū)
創(chuàng)建定時(shí)任務(wù)執(zhí)行 letsencrypt路徑/letsencrypt-auto renew
例如:
crontab -e 新增一行 30 2 * * 1 letsencrypt路徑/letsencrypt-auto renew
感謝閱讀,希望能幫助到大家,謝謝大家對(duì)本站的支持!
相關(guān)文章
ubuntu 16.04 LTS 安裝mongodb 3.2.8教程
本篇文章主要介紹了ubuntu 16.04 LTS 安裝mongodb 3.2.8教程,具有一定的參考價(jià)值,有需要的可以了解一下。2017-04-04
Linux如何定時(shí)清空日志內(nèi)容和刪除日志文件
這篇文章主要介紹了Linux如何定時(shí)清空日志內(nèi)容和刪除日志文件,具有很好的參考價(jià)值,希望對(duì)大家有所幫助,如有錯(cuò)誤或未考慮完全的地方,望不吝賜教2023-12-12
Windows和Linux系統(tǒng)下校驗(yàn)MD5值的方法
MD5(Message-Digest Algorithm 5)是一種廣泛使用的哈希算法,可用于驗(yàn)證文件完整性,通過(guò)對(duì)比文件的MD5哈希值,可確保文件未被篡改或損壞,以下是兩種操作系統(tǒng)的具體操作方法,需要的朋友可以參考下2025-04-04
sersync2 完全安裝配置說(shuō)明(二) 可選功能與xml高級(jí)配置
sersync2 完全安裝配置說(shuō)明(二) 可選功能與xml高級(jí)配置,需要的朋友可以參考下。2011-11-11

