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

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. pytest入门学习(1)

    系统ubuntu 12.04 , 可上网 一.安装: 1.安装 setuptools 下载页面:https://bitbucket.org/pypa/setuptools/get/default.ta ...

  2. 黑马方法引用学习 Stream流 函数式接口 Lambda表达式 方法引用

  3. vue 脚手架 图片预加载

    $('.back-img').onload =function(){ var img =new Image(); img.src = '../assets/dt-bj.png'; } 该组件内的图片加 ...

  4. for循环 与 for in 循环

    json是js里的一种数据格式.var obj={a:15,b:8,c:12}         这是个json对象 var arr=[15,8,12]; 数组alert(obj.a); ---15al ...

  5. 转 SecureCRT 使用X11 转发功能打开图形化窗口

    https://yq.aliyun.com/articles/53308 摘要: 有些时候,有些程序可能需要依赖图形界面才能启动,例如安装Oracle时(其实oracle支持命令行安装),例如需要启动 ...

  6. HTML <form> 标签的 enctype

    form的enctype有三种 application/x-www-form-urlencoded 在发送前编码所有字符(默认) multipart/form-data 不对字符编码. 在使用包含文件 ...

  7. DTO和ViewModel的区别

    Data Transfer Object 数据传输对象 ViewModel 视图实体(我们在新建MVC项目是会发现Model文件夹下会有一些ViewModel实体) 简单的理解一下两者之间的区别,举个 ...

  8. java threadLocal的初探

    在网上找了半天,终于找到一篇靠谱的文章了. 文章地址:http://qifuguang.me/2015/09/02/[Java%E5%B9%B6%E5%8F%91%E5%8C%85%E5%AD%A6% ...

  9. [android][windows][使用HAXM加速模拟器][不使用SDK manager]

    网上找到了来使用HAXM,可惜我在sdk manager上下载不了,也使用过勾上[fetching...]那个选项,依然无效. 所以自己手动下载来安装和使用. 具体的教程可以参考http://blog ...

  10. hdu1754I Hate It(splay)

    链接 线段树的水题,拿来学习一下splay. 本题涉及到求最大值以及单点更新,折腾了许久,差不多把splay搞明白了. 按位置建树,按位置是一颗排序二叉树,对于区间的操作非常方便,每次操作都将需要的结 ...