我目前使用Apache2向我的Ubuntu 17.01服务器颁发了SSL证书。我尝试将HTTP重定向到HTTPS,但我的Laravel Project现在不存在。但是Ubuntu默认页面可以工作。
我的SSL配置
<IfModule mod_ssl.c>
<VirtualHost _default_:443>
RewriteEngine On
RewriteCond %{HTTPS} !=on
RewriteRule ^/?(.*) https://%{SERVER_NAME}/$1 [R,L]
ServerAdmin webmaster@localhost
ServerName pdrrmo-bulacan.me
ServerAlias www.pdrrmo-bulacan.me
DocumentRoot /var/www/html
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
SSLEngine on
SSLCertificateFile /etc/apache2/ssl/pdrrmo-bulacan.me.crt
SSLCertificateKeyFile /etc/apache2/ssl/pdrrmo-bulacan.me.key
<FilesMatch "\.(cgi|shtml|phtml|php)$">
SSLOptions +StdEnvVars
</FilesMatch>
<Directory /usr/lib/cgi-bin>
SSLOptions +StdEnvVars
</Directory>
</VirtualHost>
我的laravel conf
<VirtualHost *:80>
ServerAdmin einnar82@gmail.com
DocumentRoot /var/www/html/pdrrmo-prod/public
ServerName pdrrmo-bulacan.me
ServerAlias www.pdrrmo-bulacan.me
Redirect / https://pdrrmo-bulacan.me
<Directory /var/www/html/pdrrmo-prod/>
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}
Options +FollowSymlinks
AllowOverride All
Require all granted
</Directory>
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>