1

I'm trying to redirect all HTTP requests to HTTPS in a Bitnami LAMP environment.

At first I followed the steps here but it did not work. I also tried the answer of this question and basically everything in between.

Here is what I have currently.

bitnami.conf:

# Default Virtual Host configuration.  

# Let Apache know we're behind a SSL reverse proxy
SetEnvIf X-Forwarded-Proto https HTTPS=on

<VirtualHost _default_:80>  
    RewriteEngine On  
    RewriteCond %{HTTP_HOST} !^(localhost|127.0.0.1)  
    RewriteRule ^(.*)$ https://XXXXXX.com$1 [R=permanent,L]  
    DocumentRoot "/opt/bitnami/apache/htdocs"  
    
    <Directory "/opt/bitnami/apache/htdocs">    
        Options Indexes FollowSymLinks    
        AllowOverride All    
        Require all granted  
    </Directory> 
    
    # Error Documents  
    ErrorDocument 503 /503.html

</VirtualHost>

Include "/opt/bitnami/apache/conf/bitnami/bitnami-ssl.conf"

bitnami-ssl.conf:

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

Listen 443
SSLProtocol all -SSLv2 -SSLv3
SSLHonorCipherOrder on
SSLCipherSuite "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
SSLPassPhraseDialog  builtin
SSLSessionCache "shmcb:/opt/bitnami/apache/logs/ssl_scache(512000)"
SSLSessionCacheTimeout  300

<VirtualHost _default_:443>
    RewriteEngine On  
    RewriteCond %{HTTP_HOST} !^XXXXXX.com$  
    RewriteCond %{HTTP_HOST} !^(localhost|127.0.0.1) 
    RewriteRule ^(.*)$ https://XXXXXXX.com$1 [R=permanent,L]  
    DocumentRoot "/opt/bitnami/apache/htdocs"  
    SSLEngine on  
    SSLCertificateFile "/opt/bitnami/apache/conf/bitnami/certs/server.crt"  
    SSLCertificateKeyFile "/opt/bitnami/apache/conf/bitnami/certs/server.key"  
    <Directory "/opt/bitnami/apache/htdocs">    
        Options Indexes FollowSymLinks    
        AllowOverride All    
        Require all granted  
    </Directory> 

    # Error Documents
    ErrorDocument 503 /503.html
</VirtualHost>

Please help, I've been pulling my hair out over this one. And yes I have been restarting apache.

tmath
  • 111
  • 2
  • 1
    Bitnami Engineer here. Did you deploy a custom application on top of the LAMP solution? If you did so, you probably followed [this guide](https://docs.bitnami.com/aws/infrastructure/lamp/administration/create-custom-application-php/) and it explains you how to create a configuration file to serve that custom PHP application. In this case, you will also need to include the "Rewrite" configuration lines in those configuration files and restart Apache for the changes to take effect. – Jota Martos Nov 11 '21 at 14:43

0 Answers0