Apache 禁用 https 重定向以更新证书
Apache disable https redirect to renew certificate
我需要更新我的 letsencrypt 证书。为此,我需要禁用 http 到 https 重定向。
但是我做不到。
我是 运行 Apache 和 Raspbian。这是我的 sites-available/000-default.conf:
<VirtualHost *:80>
ServerAdmin example@mail.com
DocumentRoot "/var/www/html/tennis/public"
DirectoryIndex index.php
<Directory /var/www/html/tennis/public>
Options All
AllowOverride All
Order Allow,Deny
Allow from all
</Directory>
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
#RewriteEngine on
#RewriteCond %{SERVER_NAME} = my.domain.com
#RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanent]
</VirtualHost>
虽然注释掉最后三行可以解决问题,但我仍然收到 301 重定向到 https。
我的 .htaccess 看起来像这样:
<IfModule mod_rewrite.c>
<IfModule mod_negotiation.c>
Options -MultiViews -Indexes
</IfModule>
#Header always edit Set-Cookie (.*) ;Secure
Header always append X-Frame-Options DENY
#Header set Connection keep-alive
RewriteEngine On
# Handle Authorization Header
RewriteCond %{HTTP:Authorization} .
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
# Redirect Trailing Slashes If Not A Folder...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} (.+)/$
RewriteRule ^ %1 [L,R=301]
# Handle Front Controller...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]
</IfModule>
如果我使用 IP 地址,我可以通过 http 访问该网站,所以我知道 http 仍然有效。
所以我不知道在哪一点我仍然得到了重定向到 https。第一次安装证书时,我使用 certbot 总是重定向到 https,可能是它在其他地方设置了这个重定向?
好的,这对我来说根本不是问题。我的 dyndns 提供商的证书有问题,因此出现此错误。
我需要更新我的 letsencrypt 证书。为此,我需要禁用 http 到 https 重定向。 但是我做不到。
我是 运行 Apache 和 Raspbian。这是我的 sites-available/000-default.conf:
<VirtualHost *:80>
ServerAdmin example@mail.com
DocumentRoot "/var/www/html/tennis/public"
DirectoryIndex index.php
<Directory /var/www/html/tennis/public>
Options All
AllowOverride All
Order Allow,Deny
Allow from all
</Directory>
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
#RewriteEngine on
#RewriteCond %{SERVER_NAME} = my.domain.com
#RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanent]
</VirtualHost>
虽然注释掉最后三行可以解决问题,但我仍然收到 301 重定向到 https。
我的 .htaccess 看起来像这样:
<IfModule mod_rewrite.c>
<IfModule mod_negotiation.c>
Options -MultiViews -Indexes
</IfModule>
#Header always edit Set-Cookie (.*) ;Secure
Header always append X-Frame-Options DENY
#Header set Connection keep-alive
RewriteEngine On
# Handle Authorization Header
RewriteCond %{HTTP:Authorization} .
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
# Redirect Trailing Slashes If Not A Folder...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} (.+)/$
RewriteRule ^ %1 [L,R=301]
# Handle Front Controller...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]
</IfModule>
如果我使用 IP 地址,我可以通过 http 访问该网站,所以我知道 http 仍然有效。
所以我不知道在哪一点我仍然得到了重定向到 https。第一次安装证书时,我使用 certbot 总是重定向到 https,可能是它在其他地方设置了这个重定向?
好的,这对我来说根本不是问题。我的 dyndns 提供商的证书有问题,因此出现此错误。