Nginx学习笔记(一)如何配置一个安全的HTTPS网站服务器

一、系统环境

1、系统:Ubuntu 16.04.2 LTS

2、WEB服务器:Openresty11.2.5

二、开始配置

1、获取certbot客户端

2、停止Nginx服务

3、生成证书

当前网站有多个域名时需在后面增加,例如:

./certbot-auto certonly –standalone –email `你的邮箱地址` -d `你的域名1` -d `你的域名2`

可能会出现错误1OSError: Command /opt/eff.org/certbot/venv/bin/python2.7 – setuptools pkg_resources pip wheel failed with error code 2

解决办法:

可能会出现错误2:

解决:说明你的Nginx服务还在运行啊!赶紧的kill掉啊

成功生成证书的输出结果:

4、查看生产的证书

5、编辑Nginx配置文件和开启SSL服务

配置虚拟主机

6、重启Nginx服务

 7、Let’s Encrypt 生成的免费证书为3个月时间,使用Crontab可以无限次续签证书

 遇到的坑,查边所有的地方都不能够解决,最后是内存不够用的问题?

如何解决:

 最后记得释放掉分配的交换分区

 Ubuntu 16.04更新遇到的错误:

Reading package lists... Done Reading package lists... Done Building dependency tree Reading state information... Done augeas-lenses is already the newest version (1.4.0-0ubuntu1). ca-certificates is already the newest version (20160104ubuntu1). gcc is already the newest version (4:5.3.1-1ubuntu1). libaugeas0 is already the newest version (1.4.0-0ubuntu1). libffi-dev is already the newest version (3.2.1-4). python is already the newest version (2.7.11-1). python-dev is already the newest version (2.7.11-1). libssl-dev is already the newest version (1.0.2g-1ubuntu4.5). openssl is already the newest version (1.0.2g-1ubuntu4.5). python-virtualenv is already the newest version (15.0.1+ds-3ubuntu1). virtualenv is already the newest version (15.0.1+ds-3ubuntu1). 0 upgraded, 0 newly installed, 0 to remove and 3 not upgraded. Creating virtual environment... Traceback (most recent call last): File "/usr/lib/python3/dist-packages/virtualenv.py", line 2363, in <module> main() File "/usr/lib/python3/dist-packages/virtualenv.py", line 719, in main symlink=options.symlink) File "/usr/lib/python3/dist-packages/virtualenv.py", line 988, in create_environment download=download, File "/usr/lib/python3/dist-packages/virtualenv.py", line 918, in install_wheel call_subprocess(cmd, show_stdout=False, extra_env=env, stdin=SCRIPT) File "/usr/lib/python3/dist-packages/virtualenv.py", line 812, in call_subprocess % (cmd_desc, proc.returncode)) OSError: Command /root/.local/share/letsencrypt/bin/python2.7 - setuptools pkg_resources pip wheel failed with error code 2

解决办法:sudo apt install letsencrypt

 

原文链接:https://www.cnblogs.com/tinywan/p/7542629.html

原创文章,作者:优速盾-小U,如若转载,请注明出处:https://www.cdnb.net/bbs/archives/18462

(0)
上一篇 2023年12月23日 12:49
下一篇 2023年12月23日 13:52

相关推荐

发表回复

您的电子邮箱地址不会被公开。 必填项已用*标注

优速盾注册领取大礼包www.cdnb.net
/sitemap.xml