标签: lets-encrypt

将 www 重定向到非 www(apache、letsencrypt)

Ubuntu 14.04 Apache 2.4.18

我已经使用 letencrypt 设置了 SSL 证书。它运行良好,但为了工作,我不能在一个虚拟主机配置文件中定义多个虚拟主机。每个虚拟主机都必须位于 /etc/apache2/sites-available 内的自己的 .conf 文件中。

我需要确保对 www.example.com 的所有请求都重定向到 example.com。由于我需要在唯一的虚拟主机文件中解决它,我试图在里面包含一个重写规则来执行重定向,但到目前为止它无声地失败了:所有https://www.example.com请求都没有被重定向到https ://example.com并显示“不安全的网站”警告。

这是 domain.com-le-ssl.conf 的虚拟主机配置文件。

<IfModule mod_ssl.c>
<VirtualHost *:443>
        ServerName example.com
        ServerAlias www.example.com

        RewriteEngine on
        RewriteCond %{HTTP_HOST} ^www\.(.+) [NC]
        RewriteRule ^ https://%1%{REQUEST_URI} [L,R=301]

        DocumentRoot /home/user_account/www/example.com/public
        <Directory /home/user_account/www/example.com/public>
                Options Indexes FollowSymLinks
        AllowOverride All
        Require all granted
    </Directory>

        ProxyPassMatch ^/(.*\.php(/.*)?)$ fcgi://127.0.0.1:9000/home/user_account/www/example.com/public/$1

SSLCertificateFile /etc/letsencrypt/live/example.com/fullchain.pem
SSLCertificateKeyFile /etc/letsencrypt/live/example.com/privkey.pem
Include /etc/letsencrypt/options-ssl-apache.conf
</VirtualHost>
</IfModule>
Run Code Online (Sandbox Code Playgroud)

rewrite ssl-certificate apache-2.4 lets-encrypt

3
推荐指数
1
解决办法
2753
查看次数

我是否需要在 LAMP 中为 HTTPS 网站配置端口 80?

我有一个 LAMP 网络服务器,上面有https://sslhosting.cz/域。

首先,我附上一个通用的 Let's Encrypt 配置文件,我根据需要对其进行了更改:

/etc/letsencrypt/options-ssl-apache.conf

# Baseline setting to Include for all Let's Encrypt SSL sites


SSLEngine               on


# Intermediate configuration, tweak to your needs
SSLProtocol             all -SSLv2 -SSLv3
SSLCipherSuite          ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:ECDHE-ECDSA-AES128-GCM-SHA256:ECDH$
SSLHonorCipherOrder     on
SSLCompression          off
SSLOptions              +StrictRequire


# Add vhost name to log entries:
LogFormat               "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-agent}i\"" vhost_combined
LogFormat               "%v %h %l %u %t \"%r\" %>s %b" vhost_common


#CustomLog              /var/log/apache2/access.log vhost_combined
#LogLevel               warn
#ErrorLog               /var/log/apache2/error.log


# Always ensure …
Run Code Online (Sandbox Code Playgroud)

ssl lamp lets-encrypt

3
推荐指数
1
解决办法
1260
查看次数

LetsEncrypt:连接中出现未知的 SSL 协议错误

我有一个带有 LE 证书的主机,它在浏览器中运行良好,但我仍然无法使用curl, openssl, wget, POST(libwww-perl) 进行连接:

卷曲

# curl -v -3 https://example.com/
* Hostname was NOT found in DNS cache
*   Trying 123.123.123.123...
* Connected to example.com (123.123.123.123) port 443 (#0)
* successfully set certificate verify locations:
*   CAfile: none
  CApath: /etc/ssl/certs
* SSLv3, TLS handshake, Client hello (1):
* Unknown SSL protocol error in connection to example.com:443 
* Closing connection 0
Run Code Online (Sandbox Code Playgroud)

openssl

# openssl s_client -connect example.com:443
CONNECTED(00000003)
write:errno=104
---
no peer certificate …
Run Code Online (Sandbox Code Playgroud)

ssl openssl curl apache-2.4 lets-encrypt

3
推荐指数
1
解决办法
2317
查看次数

安装 LetsEncrypt SSL 时出错:(http-01): urn:acme:error:connection :: 服务器无法连接到客户端以验证域

我正在尝试LetsEncrypt在我的服务器上安装(我有 root SSH 访问权限),因为staging.dnslaude.com- 这是一个可公开访问的域,指向213.212.81.89.

服务器正在运行ubuntu 16.04,还有一个nginx网络服务器。下面是nginx配置:

server {
  listen 80;
  server_name staging.dnslaude.com;

  root /path/to/webroot;

  location ^~ /.well-known/acme-challenge/ {
    try_files $uri $uri/ =404;
  }
  rewrite ^(.*) https://$host$1 permanent;
}

server {
  listen 443;
  ssl on;
  ssl_certificate /path/to/self/signed/certificate.crt;
  ssl_certificate_key /path/to/key.key;

  server_name staging.dnslaude.com;

  root /path/to/webroot;

  # ....

  location ^~ /.well-known/acme-challenge/ {
    try_files $uri $uri/ =404;
  }
}
Run Code Online (Sandbox Code Playgroud)

您可以看到nginx配置似乎有效,因为我已手动将文件放置在此处acme-challenge文件夹中。

但是,当我运行命令时:

letsencrypt certonly --webroot …
Run Code Online (Sandbox Code Playgroud)

ssl nginx ssl-certificate lets-encrypt

3
推荐指数
1
解决办法
5005
查看次数

certboot 续订成功时自动重新加载 Nginx?

每三个月,我的 Let's Encrypt 证书就会过期,我的客户会获得无效的 https 证书。

所以我最近放置了以下 cron 任务:

@weekly certbot renew --quiet && service nginx reload
Run Code Online (Sandbox Code Playgroud)

据我了解,当certbot renew成功更新证书时,它会返回成功状态(exit(0)),因此&&紧随其后,因此重新加载nginx。

是的,但它不起作用。我最近让我的服务器再次显示过期的证书,所以我肯定误解了一些东西,和/或我的 cron 任务不好。

你能告诉我路径吗?:)

nginx lets-encrypt

3
推荐指数
1
解决办法
7329
查看次数

nginx certbot 证书 www 和非 www

我还没有真正了解如何使用 certbot 为 nginx 创建(工作)证书。

我的网站启用现在看起来像这样:

首先,使用 SSL 阻止 www 域。所有 SSL 的东西都是由 certbot 创建的。

server {
root …
index … 
server_name www.doman.com
listen 443 ssl;
ssl_certificate …
ssl_certificate_key …
include …
ssl_dhparam … 
}
Run Code Online (Sandbox Code Playgroud)

在此之后,为 www 和非 www 从端口 80 重定向到端口 443。第一部分——if 语句——是由 certbot 创建的,而不是我。

server {
if ($host = www.example.com {
    return 301 https://$host$request_uri;
    }

listen *:80;
server_name domain.com www.example.com;
return 301 https://www.example.com$request_uri;
Run Code Online (Sandbox Code Playgroud)

}

最后,一个没有 www 的 443 块。我希望这重定向到 www。

server {
listen 443;
server_name www.domain.com
return 301 …
Run Code Online (Sandbox Code Playgroud)

ssl nginx https lets-encrypt certbot

3
推荐指数
1
解决办法
2428
查看次数

从 Let's Encrypt 证书导出客户端证书

我正在运行Debian并且必须certbot创建Let's Encrypt证书。

我充当 TLS 服务器的客户端,需要移交我的客户端证书以供批准。

我有以下文件生成certbot

/etc/letsencrypt/live/my-client-server-domain/privkey.pem
/etc/letsencrypt/live/my-client-server-domain/fullchain.pem
/etc/letsencrypt/live/my-client-server-domain/chain.pem
Run Code Online (Sandbox Code Playgroud)

我应该交出哪个证书,公开共享是否安全?

ssl lets-encrypt certbot

3
推荐指数
1
解决办法
8104
查看次数

Nginx在ssl_certificate路径中使用变量时获取权限错误

在 Nginx 配置中,尝试动态加载 ssl_certificate 但

\n\n

使用 $ssl_server_name 变量

\n\n
   ssl_certificate /etc/letsencrypt/live/$ssl_server_name/fullchain.pem;\n   ssl_certificate_key /etc/letsencrypt/live/$ssl_server_name/privkey.pem;\n
Run Code Online (Sandbox Code Playgroud)\n\n

收到此权限错误

\n\n
\n

\xe2\x94\x822019/09/22 08:29:42 [错误] 7714#7714: *3 无法加载证书\n "/etc/letsencrypt/live/example.com/fullchain.pem": BIO_new_file()\ n 失败(SSL:错误:0200100D:系统库:fopen:权限\n被拒绝:fopen(\'/etc/letsencrypt/live/example.com/fullchain.pem\',\'r\')\n错误: 2006D002:BIO 例程:BIO_new_file:system lib) SSL\n 握手时,客户端:,服务器:0.0.0.0:443

\n
\n\n

但不使用变量,它的工作!

\n\n
  ssl_certificate /etc/letsencrypt/live/example.com/fullchain.pem;\n  ssl_certificate_key /etc/letsencrypt/live/example.com/privkey.pem;\n
Run Code Online (Sandbox Code Playgroud)\n\n

有没有办法根据server_name动态加载ssl_certificate?

\n\n

尝试了一些参考但仍然无法解决。

\n\n
    \n
  1. nginx 配置在 ssl_certificate 路径中使用变量会引发权限错误
  2. \n
  3. https://trac.nginx.org/nginx/ticket/1744
  4. \n
\n

nginx lets-encrypt

3
推荐指数
1
解决办法
1799
查看次数

使用 certbot 更新证书时版本无效

我有一台安装了 Let's encrypt 证书并安装了 certbot 的服务器。我想用以下命令更新它 sudo certbot renew --force-renewal

但我收到错误:

Saving debug log to /var/log/letsencrypt/letsencrypt.log
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Processing /etc/letsencrypt/renewal/mydomain.conf
- - - - - - - - - - - - - - - - - - - - - - …
Run Code Online (Sandbox Code Playgroud)

ubuntu lets-encrypt certbot

3
推荐指数
1
解决办法
3461
查看次数

Nginx 拒绝连接到端口 443

所以,我正在尝试让 Nginx 通过 https 为我的网站提供服务,但它不断出现拒绝连接错误。

所以这里是输出:

  1. curl https://juristnet.ro(这是网站)

    curl: (7) Failed to connect to juristnet.ro port 443: Connection refused
    
    Run Code Online (Sandbox Code Playgroud)
  2. netstat -anltp

    tcp        0      0 0.0.0.0:80              0.0.0.0:*                  LISTEN      -               
    tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN      -               
    tcp        0      0 127.0.0.1:5432          0.0.0.0:*               LISTEN      -               
    tcp        0      0 0.0.0.0:443             0.0.0.0:*               LISTEN      -               
    tcp        0      0 0.0.0.0:3306            0.0.0.0:*               LISTEN      -               
    tcp        0      0 46.101.111.197:80       66.249.64.215:60905     TIME_WAIT   -               
    tcp        0      0 46.101.111.197:80       66.249.64.211:57434     ESTABLISHED -               
    tcp        0      0 46.101.111.197:22       82.208.159.43:26902         ESTABLISHED -               
    tcp        0 …
    Run Code Online (Sandbox Code Playgroud)

ssl firewall nginx gunicorn lets-encrypt

2
推荐指数
1
解决办法
1万
查看次数