solr 将http重定向到https bitnami apache

nvbavucw  于 2022-11-05  发布在  Solr
关注(0)|答案(2)|浏览(194)

我想将我的网站的所有内容从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"

我把规则放错地方了吗?

ev7lccsx

ev7lccsx1#

我是Bitnami开发人员。
如果你想从http重定向到https,你必须修改上面提到的文件(installdir/apache 2/conf/bitnami/bitnami.conf)。

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

这些行需要放在默认的虚拟主机配置中,这样您的bitnami.conf文件就可以了。
我刚刚在Windows中安装了Solr,并将重写行复制到了bitnami.conf文件中的installdir/apache 2/conf/bitnami/bitnami.conf,重新启动Apache后重定向工作正常。您是否重新启动了服务?请注意,Apache需要重新启动才能使更改生效。
本指南说明了此更改。
希望能帮上忙。

4zcjmb1e

4zcjmb1e2#

这个问题可以通过在wordpress-vhost.conf文件中添加ReWriteRule来解决。如果您的apache安装是使用系统包完成的,请按照以下步骤操作。
要确定安装类型,请运行以下命令。

test ! -f "/opt/bitnami/common/bin/openssl" && echo "Approach A: Using system packages." || echo "Approach B: Self-contained installation."

请按照以下步骤操作,

cd /opt/bitnami/apache2/conf/vhosts

vim wordpress-vhost.conf

在virtualhost标记中添加以下行,

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

重新启动Apache

/opt/bitnami/ctlscript.sh restart

相关问题