CENTOS7 configuration Nginx Support HTTPS access implementation _linux

Source: Internet
Author: User
Tags openssl ssl certificate git clone certbot letsencrypt

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!

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.