Debian11中apache2强制使用https

apache2强制使用https

在/etc/apache2/sites-available/000-default.conf加入以下内容

1
2
3
RewriteEngine on
RewriteCond   %{HTTPS} !=on
RewriteRule   ^(.*)  https://%{SERVER_NAME}$1 [L,R]

启动apache2的重定向,并重启apache2服务

1
2
a2enmod rewrite
systemctl restart apache2
comments powered by Disqus
Built with Hugo
Theme Stack designed by Jimmy