我已为我的站点启用SSL和https。我现在想启用重定向,以将所有http请求发送到https。
我已将我的虚拟主机设置为2个文件。 1在/etc/apache2/sites-available/000-default.conf( .80)中 我在同一文件夹的default-ssl.conf中设置了另一个虚拟主机( .443)。我应该在同一文件中定义虚拟主机吗?
<VirtualHost *:80>
#ServerName www.example.com
ServerName www.pipelinedl.com
ServerAlias pipelinedl.com
Redirect permanent / https://www.pipelinedl.com/
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
<IfModule mod_ssl.c>
<VirtualHost *:443>
ServerAdmin webmaster@localhost
ServerName www.pipelinedl.com
ServerAlias pipelinedl.com
DocumentRoot /var/www/html
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
# SSL Engine Switch:
# Enable/Disable SSL for this virtual host.
SSLEngine on
SSLCertificateFile /etc/ssl/certs/8a3c11dabc2df938.crt
SSLCertificateKeyFile /etc/ssl/certs/pipelinedl.key
<FilesMatch "\.(cgi|shtml|phtml|php)$">
SSLOptions +StdEnvVars
</FilesMatch>
<Directory /usr/lib/cgi-bin>
SSLOptions +StdEnvVars
</Directory>
</VirtualHost>
</IfModule>