centos 下nignx配置letsencrypt ca證書,ssl

 

 

yum install git 

yum install zlib-devel

yum install bzip2-devel

yum install openssl-devel

yum install ncurses-devel

yum install sqlite-devel

cd/usr/local/srcwget https://www.python.org/ftp/python/2.7.12/Python-2.7.12.tar.xz

tar -zxvf Python-2.7.12.tar.xz

#編譯python

cd Python-2.7.12/

./configure --prefix=/usr/local/python2.7

make && make install

ln -s /usr/local/python2.7/bin/python2.7 /usr/local/bin/python

#解決系統 Python 軟鏈接指向 Python2.7 版本後,yum是不兼容 Python 2.7的,所需要指定 yum 的Python版本

# vi /usr/bin/yum 將頭部的

#!/usr/bin/python  改成   #!/usr/bin/python2.6.6

2、nginx安裝(自行度娘)

3、生成密鑰文件

git clone https://github.com/letsencrypt/letsencrypt

#進入letsencrypt目錄cdletsencrypt

#生成證書

./letsencrypt-auto certonly --standalone --email [email protected] -d ******

在/etc/letsencrypt/live/******(自己的域名)  下面看到privkey.pem和fullchain.pem

4、配置到nginx

server {

        listen      443 ssl;

        server_name  ******;

        ssl_certificate /etc/letsencrypt/live/******/fullchain.pem;

        ssl_certificate_key  /etc/letsencrypt/live/******/privkey.pem;

       location / {

            proxy_pass                http://127.0.0.1:8080;

            proxy_set_header          Host $host;

            proxy_set_header          X-Real-IP $remote_addr;

            proxy_set_header          X-Forwarded-For $proxy_add_x_forwarded_for;

        }

    }

5、證書有效期爲90天,需要延期

./letsencrypt-auto certonly --renew-by-default --email [email protected] -d ******

發佈了33 篇原創文章 · 獲贊 42 · 訪問量 59萬+
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章