将http重定向到https bitnami apache

时间:2016-02-06 09:21:27

标签: apache solr https bitnami

我想将我网站的所有内容从http重定向到https。我尝试在bitnami.config文件中添加以下内容,但没有用。

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

以下是bitnami.config文件的内容

# Default Virtual Host configuration.

<IfVersion < 2.3 >
NameVirtualHost *:8080
NameVirtualHost *:443
</IfVersion>

<VirtualHost _default_:8080>
DocumentRoot "C:/Bitnami/solr-5.3.0-0/apache2/htdocs"

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

<Directory "C:/Bitnami/solr-5.3.0-0/apache2/htdocs">
Options Indexes FollowSymLinks
AllowOverride All
<IfVersion < 2.3 >
  Order allow,deny                          
  Allow from all
</IfVersion>
<IfVersion >= 2.3 >
  Require all granted
</IfVersion>
</Directory>

# Error Documents
ErrorDocument 503 /503.html

# Bitnami applications installed with a prefix URL (default)
Include "C:/Bitnami/solr-5.3.0-0/apache2/conf/bitnami/bitnami-apps-    prefix.conf"

</VirtualHost>

# Default SSL Virtual Host configuration.

<IfModule !ssl_module>
LoadModule ssl_module modules/mod_ssl.so
</IfModule>

Listen 443
SSLProtocol all -SSLv2 -SSLv3
SSLHonorCipherOrder on
SSLCipherSuite "EECDH+ECDSA+AESGCM EECDH+aRSA+AESGCM EECDH+ECDSA+SHA384   EECDH+ECDSA+SHA256 EECDH+aRSA+SHA384 EECDH+aRSA+SHA256 EECDH !aNULL !eNULL !LOW !3DES !MD5 !EXP !PSK !SRP !DSS !EDH !RC4"
SSLPassPhraseDialog  builtin
SSLSessionCache "shmcb:C:/Bitnami/solr-5.3.0-0/apache2/logs/ssl_scache(512000)"
SSLSessionCacheTimeout  300

<VirtualHost _default_:443>
 DocumentRoot "C:/Bitnami/solr-5.3.0-0/apache2/htdocs"
 SSLEngine on
 SSLCertificateFile "C:/Bitnami/solr-5.3.0-0/apache2/conf/server.crt"
 SSLCertificateKeyFile "C:/Bitnami/solr-5.3.0-0/apache2/conf/server.key"

<Directory "C:/Bitnami/solr-5.3.0-0/apache2/htdocs">
Options Indexes FollowSymLinks
AllowOverride All
<IfVersion < 2.3 >
  Order allow,deny                          
  Allow from all
</IfVersion>
<IfVersion >= 2.3 >
  Require all granted
</IfVersion>
</Directory>

# Error Documents
ErrorDocument 503 /503.html

# Bitnami applications installed with a prefix URL (default)
Include "C:/Bitnami/solr-5.3.0-0/apache2/conf/bitnami/bitnami-apps- prefix.conf"
</VirtualHost>

# Bitnami applications that uses virtual host configuration
Include "C:/Bitnami/solr-5.3.0-0/apache2/conf/bitnami/bitnami-apps-vhosts.conf"

我是否以错误的方式放置了规则?

1 个答案:

答案 0 :(得分:2)

Bitnami开发者在这里。

如果要从http重定向到https,则必须修改上面提到的文件(installdir / apache2 / conf / bitnami / bitnami.conf)。

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

这些行需要放在默认的虚拟主机配置中,这样你的bitnami.conf文件就可以了。

我刚刚在Windows中安装了Solr,我将重写行复制到installdir / apache2 / conf / bitnami / bitnami.conf中的bitnami.conf文件,重启后,重定向工作正常。你重新启动了服务吗?请注意,需要重新启动Apache才能使更改生效。

guide解释了这一变化。

我希望它有所帮助。