CENTOS7 configuration Nginx Support HTTPS access
1. Install git and BC
yum-y Install git BC
2. Install Nginx
1. Preparation:
Yum install-y gcc-c++ pcre pcre-devel zlib zlib-devel OpenSSL openssl-devel
2. Download:
wget https://nginx.org/download/nginx-1.11.6.tar.gz
3. Decompression:
Tar zxvf nginx-1.11.6.tar.gz
4. Compile and install:
CD nginx-1.11.6
./configure--with-ipv6--with-http_ssl_module make make
install
3. Request an SSL certificate
1. Download Let ' s Encrypt
git clone https://github.com/wjg1101766085/certbot.git
2. Run let ' s Encrypt
CD Certbot
./letsencrypt-auto
To generate a file:
CERT.PEM: Domain name certificate
Chain.pem:The let ' s Encrypt certificate
FULLCHAIN.PEM: The top two fit together
PRIVKEY.PEM: Certificate Key
4. Configure Nginx
1. Modify the nginx.conf file
nano/usr/local/nginx/conf/nginx.conf
add:
ssl_certificate/etc/letsencrypt/live/domain name/FULLCHAIN.PEM;
ssl_certificate_key/etc/letsencrypt/live/domain name/PRIVKEY.PEM;
Modification:
server_name domain name;
5. Automatic Renewal Certificate
Create a timed task to execute the Letsencrypt path/letsencrypt-auto renew
For example:
CRONTAB-E
New Line
2 * * 1 Letsencrypt path/letsencrypt-auto Renew
Thank you for reading, I hope to help you, thank you for your support for this site!