0、准备工作(已经安装可以不需要再安装)
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 abc@163.com -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 abc@163.com -d ******
网友评论