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

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. SpringBoot | 启动异常 | 显示bulid success 无 error信息

    可能原因是没有添加 web 依赖,检查pom里面是否有web <dependency> <groupId>org.springframework.boot</groupI ...

  2. LINK fatal error LNK1123 转换到COFF期间失败

    1>LINK : fatal error LNK1123: 转换到 COFF 期间失败: 文件无效或损坏 全部重新生成: 0 已成功, 1 已失败, 0 已跳过 ==========解决方法如下 ...

  3. NOIP前模拟赛总结

    NOIP前模拟赛总结 from 2018.10.7 to ??? Date Name Score(Rank) Problems 2018.10.7 McfXH AK Contest 42(?) 期望得 ...

  4. 使用Hexo 搭建自己的博客

    使用Hexo 搭建自己的博客 最近一直都想着如何去搭建属于自己的博客,有空的时候就写写文章什么的. 本人对该博客系统的要求是: 博文的编写要采用现在流行的MarkDown来进行编写. 本人还不想去注册 ...

  5. Codeforces Round #402 (Div. 2) A

    Description In Berland each high school student is characterized by academic performance — integer v ...

  6. robot framework 在pycharm中语法无法高亮显示的,显示绿色解决办法(Robot Framework with PyCharm)

    Robot Framework with PyCharm up vote1down votefavorite 1 I am totally new to automation and trying t ...

  7. 51NOD 1202 子序列个数 DP

    http://www.51nod.com/onlineJudge/questionCode.html#!problemId=1202&judgeId=225600 这题看起来挺复杂,但是真正的 ...

  8. Unity Shader入门精要学习笔记 - 第13章 使用深度和法线纹理

    线纹理的代码非常简单,但是我们有必要在这之前首先了解它们背后的实现原理. 深度纹理实际上就是一张渲染纹理,只不过它里面存储的像素值不是颜色值而是一个高精度的深度值.由于被存储在一张纹理中,深度纹理里的 ...

  9. mysql join操作

    join的类型 1.  内联结:将两个表中存在联结关系的字段符合联结关系的那些记录形成记录集的联结. 2.  外联结:分为外左联结和外右联结. 案例背景 create table java (name ...

  10. ACM学习大纲(转)

    1 推荐题库 •http://ace.delos.com/usaco/ 美国的OI 题库,如果是刚入门的新手,可以尝试先把它刷通,能够学到几乎全部的基础算法极其优化,全部的题解及标程还有题目翻译可以b ...