运行的时候一直报如下的错误:

sudo certbot

  

错误结果:

Traceback (most recent call last):
File "/usr/lib/python-exec/python2.7/certbot", line 11, in <module>
load_entry_point('certbot==0.30.1', 'console_scripts', 'certbot')()
File "/usr/lib/python2.7/site-packages/pkg_resources/__init__.py", line 487, in load_entry_point
return get_distribution(dist).load_entry_point(group, name)
File "/usr/lib/python2.7/site-packages/pkg_resources/__init__.py", line 2728, in load_entry_point
return ep.load()
File "/usr/lib/python2.7/site-packages/pkg_resources/__init__.py", line 2346, in load
return self.resolve()
File "/usr/lib/python2.7/site-packages/pkg_resources/__init__.py", line 2352, in resolve
module = __import__(self.module_name, fromlist=['__name__'], level=0)
File "/usr/lib/python2.7/site-packages/certbot/main.py", line 10, in <module>
import josepy as jose
File "/usr/lib/python2.7/site-packages/josepy/__init__.py", line 44, in <module>
from josepy.interfaces import JSONDeSerializable
File "/usr/lib/python2.7/site-packages/josepy/interfaces.py", line 8, in <module>
from josepy import errors, util
File "/usr/lib/python2.7/site-packages/josepy/util.py", line 4, in <module>
import OpenSSL
File "/usr/lib/python2.7/site-packages/OpenSSL/__init__.py", line 8, in <module>
from OpenSSL import crypto, SSL
File "/usr/lib/python2.7/site-packages/OpenSSL/crypto.py", line 16, in <module>
from OpenSSL._util import (
File "/usr/lib/python2.7/site-packages/OpenSSL/_util.py", line 6, in <module>
from cryptography.hazmat.bindings.openssl.binding import Binding
File "/usr/lib/python2.7/site-packages/cryptography/hazmat/bindings/openssl/binding.py", line 13, in <module>
from cryptography.hazmat.bindings._openssl import ffi, lib
ImportError: /usr/lib/python2.7/site-packages/cryptography/hazmat/bindings/_openssl.so: undefined symbol: X509_get_signature_nid

  

搜索一圈无果

试图删除 cryptography 之后重新安装还是没用。

于是想到是不是因为openssl太旧了。

更新下

sudo emerge -u dev-libs/openssl

  

重新安装certbot,

sudo emerge -av app-crypt/certbot app-crypt/certbot-nginx

  

再次运行

sudo certbot --nginx

结果如下:

Saving debug log to /var/log/letsencrypt/letsencrypt.log
The nginx plugin is not working; there may be problems with your existing configuration.
The error was: NoInstallationError("Could not find a usable 'nginx' binary. Ensure nginx exists, the binary is executable, and your PATH is set correctly.",)

  

恩,虽然没成功,但是没有代码错误了

以上错误是因为 nginx 没有放到环境变量中去,我系统的真正的nginx在/opt/nginx/sbin/nginx,于是我做了个软链接。

sudo ln -s /opt/nginx/sbin/nginx /usr/local/bin/nginx

  

再次执行命令

sudo certbot --nginx

得到结果:

Saving debug log to /var/log/letsencrypt/letsencrypt.log
The nginx plugin is not working; there may be problems with your existing configuration.
The error was: PluginError('Nginx build is missing SSL module (--with-http_ssl_module).',)

查看nginx版本

$ nginx -V

结果:
nginx version: nginx/1.6.3
built by gcc 4.8.4 (Gentoo 4.8.4 p1.5, pie-0.6.1)
configure arguments: --prefix=/opt/nginx --with-http_geoip_module --add-module=/usr/src/passenger-4.0.53/ext/nginx

果然是没有ssl模块!

决定rebuild下nginx with ssl

下载nginx,我之前有下载过1.6.2还保留在那,于是直接进目录重新build。运行下面命令的时候最好用root权限

./configure --prefix=/opt/nginx --with-http_ssl_module --with-http_gzip_static_module --with-http_stub_status_module --with-cc-opt=-Wno-error --with-http_geoip_module --add-module=/usr/src/passenger-4.0.53/ext/nginx
make && make install

 

完成, 再检查一次nginx版本,已经加上了ssl模块

$ nginx -V
结果
nginx version: nginx/1.6.2
built by gcc 5.4.0 (Gentoo 5.4.0-r3 p1.3, pie-0.6.5)
TLS SNI support enabled
configure arguments: --prefix=/opt/nginx --with-http_ssl_module --with-http_gzip_static_module --with-http_stub_status_module --with-cc-opt=-Wno-error --with-http_geoip_module --add-module=/usr/src/passenger-4.0.53/ext/nginx

返回最初的certbot命令再来一次, 提示我去做设置了,成功在即!

$ sudo certbot --nginx
Password:
Saving debug log to /var/log/letsencrypt/letsencrypt.log
Plugins selected: Authenticator nginx, Installer nginx
Enter email address (used for urgent renewal and security notices) (Enter 'c' to
cancel):

  

跟着提示填上email,选择需要activate HTTPS 的域名。至此nginx配置成功

  

重启nginx出现如下错误

sudo /etc/init.d/nginx restart
Password:
* Checking nginx' configuration ... [ ok ]
* Stopping nginx ... [ ok ]
* Starting nginx ...
nginx: [emerg] bind() to 0.0.0.0:443 failed (98: Address already in use)
nginx: [emerg] bind() to 0.0.0.0:443 failed (98: Address already in use)
nginx: [emerg] bind() to 0.0.0.0:443 failed (98: Address already in use)
nginx: [emerg] bind() to 0.0.0.0:443 failed (98: Address already in use)
nginx: [emerg] bind() to 0.0.0.0:443 failed (98: Address already in use)
nginx: [emerg] still could not bind()
* start-stop-daemon: failed to start `/opt/nginx/sbin/nginx'
* Failed to start nginx [ !! ]
* ERROR: nginx failed to start

上述错误是因为我安装shadowsocket代理的时候占用了443 端口,于是我把shadowsocket绑定的端口改成543,然后重新启动nginx。

  解决办法:

sudo fuser -k 443/tcp
sudo /etc/init.d/nginx restart

  



更新portage之后 安装 certbot的更多相关文章

  1. Gentoo更新portage记录

    小记一下这两天更新服务器版本遇到的各种问题. 服务器系统: Gentoo 第一天 其实本来不打算更新系统的,因为最近想试试免费的SSL证书,于是自然而然搜到了letsencrypt,跟着他们的流程需要 ...

  2. Ubuntu14.04更新源、安装chrome/搜狗输入法

    目录: 1.更新源 2.安装chrome 3.安装搜狗输入法     1.更新源 三步: cp /etc/apt/sources.list /etc/apt/sources.list_backup   ...

  3. ubuntu nginx 安装 certbot(letsencrypt)

    https://certbot.eff.org 到上面网站按照步骤安装certbot, 安装完成后,certbot 生成证书有两种方式 第一种:standalone模式,certbot 会启动自带的n ...

  4. android自动更新程序,安装完以后就什么都没有了,没有出现安装成功的界面的问题

    转载自: http://blog.csdn.net/lovexieyuan520/article/details/9250099 在android软件开发中,总是需要更新版本,所以当有新版本开发的时候 ...

  5. FreeBSD系统更新与软件安装方法

    一.系统更新 freebsd-update fetch freebsd-update install 二.软件源更新(类似yum update.apt-get update) 1.取回源 portsn ...

  6. 双击更新所有已安装的python模块

     首先声明我是一个升级控.几乎每天会查看一下手机.电脑是否有新的应用需要更新. 同样,我的python模块也是这样.百度了一下,发现目前还没有人将更新所有模块做成一件命令,但是查到了指引,主要就是两个 ...

  7. Debian 8添加kali更新源并安装metasploit

    一.Debian 8添加kali更新源 中科大kali更新源: deb http://mirrors.ustc.edu.cn/kali kali-rolling main non-free contr ...

  8. 解决python3 pip安装、更新及yaml安装

    问题:python3.6版本使用pip安装第三方库时总是报错 电脑中存在多个python版本写成对应pip版本 解决:pip3 install pyOpenSSL -i http://pypi.dou ...

  9. 嵌入式开发板LInux更新系统、安装软件、下载资源碰到的问题

    CAfile: /etc/ssl/certs/ca-certificates.crt CRLfile: none 先同步系统时间 shell 输入命令 date 如果显示的时间跟你本地时间不一样,先设 ...

随机推荐

  1. 1.python真的是万恶之源么?(初识python)

    python真的是万恶之源么? 计算机基础及puthon了解 1.计算机基础知识 cpu : 相当于人类大脑,运算和处理问题 内存 : 临时存储数据,单点就消失,4G,8G,16G,32G 硬盘 : ...

  2. bzoj 4695: 最假女选手 && Gorgeous Sequence HDU - 5306 && (bzoj5312 冒险 || 小B的序列) && bzoj4355: Play with sequence

    算导: 核算法 给每种操作一个摊还代价(是手工定义的),给数据结构中某些东西一个“信用”值(不是手动定义的,是被动产生的),摊还代价等于实际代价+信用变化量. 当实际代价小于摊还代价时,增加等于差额的 ...

  3. Hadoop启动datanode失败,clusterId有问题

    问题: 搭建伪Hadoop集群的时候,运行命令: hdfs namenode -format 格式化或者说初始化namenode. 然后用命令: start-dfs.sh 来启动hdfs时,jps发现 ...

  4. Springboot的static和templates

    static和templates部分参考博客:https://blog.csdn.net/wangb_java/article/details/71775637 热部署参考博客:https://www ...

  5. Java微信公众平台开发(八)--多媒体消息回复之音乐

    我们上一篇写了关注出发图片的回复.想着在发送一次音乐,最后基于回复消息分类情况下,实现一个简单的只能话回复.先附一张大致效果图. 下面我们进入代码阶段. (一)修改消息转发器MsgDispatcher ...

  6. 谈PHP中的钩子

    钩子,英文为hooks.在程序中应用相当广泛,但是究竟什么是钩子呢?本人介绍一下目前本人对钩子的理解和相关心得. 假如有这么一段程序流: function fun(){ funA(); funB(); ...

  7. java.lang.IllegalArgumentException: Illegal character in query at index ...解决办法

    今天在写智能机器人问答实现的时候遇到了一个问题,就是我发送消息不能输入空格 给我报了一个错误java.lang.IllegalArgumentException: Illegal character ...

  8. CF1149A Prefix Sum Primes

    思路: 质数一定是奇数.实现: #include <bits/stdc++.h> using namespace std; int main() { int n, t, x, y; whi ...

  9. arcgis jsapi接口入门系列(8):鼠标在地图画面

    初始化,每个map执行一次 PS:画点也差不多,都是用SketchViewModel,因此本demo没有专门写画点的 drawPolygonInit: function () { //画几何对象初始化 ...

  10. sublime前端插件以及常用快捷键

    29个常用 Sublime Text 插件推荐 来源:互联网 作者:佚名 时间:06-18 09:27:55 [大 中 小] Sublime Text具有漂亮的用户界面和强大的功能,例如代码缩略图,P ...