这是我当前的 /frontend/web 的 htaccess 配置
RewriteEngine on
RewriteCond %{HTTPS} !=on
RewriteRule ^.*$ https://%{SERVER_NAME} [R,L]
# if a directory or a file exists, use it directly
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
# otherwise forward it to index.php
RewriteRule . index.php
我试图插入这个:
RewriteCond %{REQUEST_URI} !^.well-known/acme-challenge/$
或者RewriteCond %{REQUEST_URI} ! /\.well-known|^\.well-known
以上
RewriteRule ^.*$ https://%{SERVER_NAME} [R,L]
创建 Let's Encrypt 证书的方法不起作用。以下是用于创建证书的 Let's Encrypt 命令(由于使用 Centos6,启用了调试模式):./letsencrypt-auto --debug certonly --webroot -w /var/www/html/example.com/frontend/web/ --email example@gmail.com --domains example.com
letsencrypt错误:
The following errors were reported by the server:
Domain: example.com
Type: unauthorized
Detail: Invalid response from
http://example.com/.well-known/acme-challenge/%acme%
点击上面的链接会跳转到网站协议的 HTTPS 版本。如果我删掉重定向到 HTTPS 的操作,我会收到一个证书成功接收的消息。结论是:.well-known 仍然会被发送到 HTTPS,我的设置没有生效,我做错了什么?
.htaccess
文件中的RewriteEngine On
之后即可:RewriteCond %{HTTP_HOST} !^\.well-known/.+
。 - ETech