0
我有一個在Ubuntu上運行的apache2服務器,我正在努力提升系統管理員的技能。我一直試圖在整個網站上使用HTTPS設置一個網絡服務器。目前,如果我去https://mysite.com它工作得很好。我已經嘗試了一些不同的重定向規則,以使與該網站的所有連接都被強制爲HTTPS,但我沒有運氣。任何人都可以在此指出我的錯誤嗎?HTTP到HTTPS Apache重寫不起作用
的httpd.conf:
NameVirtualHost *:443
<VirtualHost *:443>
ServerName mysite.com
ServerAdmin [email protected]
DocumentRoot /var/www/
SSLEngine on
SSLOptions +FakeBasicAuth -StrictRequire +ExportCertData
SSLCertificateKeyFile /etc/ssl/crt/myserver.key
SSLCertificateFile /etc/ssl/crt/mysite_com.crt
SSLCertificateChainFile /etc/ssl/crt/mysite.ca-bundle
<Directory />
Options FollowSymLinks
AllowOverride None
</Directory>
<Directory /var/www/>
Options Indexes FollowSymLinks MultiViews
AllowOverride AuthConfig Options FileInfo Limit
Order allow,deny
allow from all
</Directory>
</VirtualHost>
<IfModule !mod_rewrite.c>
LoadModule rewrite_module modules/mod_rewrite.so
</IfModule>
RewriteEngine On
RewriteCond %{HTTPS} !=on
RewriteRule ^/(.*) https://%{SERVER_NAME}/$1 [R,L]
ports.conf:
NameVirtualHost *:80
Listen 80
<IfModule mod_ssl.c>
# If you add NameVirtualHost *:443 here, you will also have to change
# the VirtualHost statement in /etc/apache2/sites-available/default-ssl
# to <VirtualHost *:443>
# Server Name Indication for SSL named virtual hosts is currently not
# supported by MSIE on Windows XP.
Listen 443
</IfModule>
<IfModule mod_gnutls.c>
Listen 443
</IfModule>
任何幫助,不勝感激!