似乎我在虚拟主机配置文件中将所有http请求重定向到https时出错了
这是我当前的工作配置:
/etc/apache2/sites-available/a.com.conf
<VirtualHost *:80>
ServerAdmin [email protected]
ServerName a.com
ServerAlias *.a.com
DocumentRoot /var/www/a.com/html
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
RewriteEngine on
RewriteCond %{SERVER_NAME} =a1.a.com [OR]
RewriteCond %{SERVER_NAME} =a.com
RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanent]
</VirtualHost>
/etc/apache2/sites-available/a.com-le-ssl.conf
<IfModule mod_ssl.c>
<VirtualHost *:443>
ServerAdmin [email protected]
ServerName a.com
ServerAlias *.a.com
DocumentRoot /var/www/a.com/html
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
Include /etc/letsencrypt/options-ssl-apache.conf
SSLCertificateFile /etc/letsencrypt/live/a.com/fullchain.pem
SSLCertificateKeyFile /etc/letsencrypt/live/a.com/privkey.pem
</VirtualHost>
</IfModule>
但是,需要更新虚拟主机配置
RewriteCond %{SERVER_NAME} =a1.a.com [OR]
因此,对于我需要的每个子域,该过程都不是自动化的。