mercredi 4 septembre 2019

Https page in AWS not loading with laravel

I have an old page hosted in AWS with Laravel 5.2, the page was working in Ubuntu 14.04. But the client had the need to upgrade from HTTP to HTTPS, and now my page is not loading.

So my client decided to buy the HTTPS certificated in Amazon and didn't tell me about it. This change made the page unable to save more data since it was not a trusted page. After reading a lot and talking with the client we decided to get a self signed certificate. So to get it, I had to upgrade the server from Ubuntu 14.04 to 18.04 since the old version of Apache2 didn't work with SSLSessionTickets. With the upgrade the Apache page showed in the URL of the server, showing that the Apache was working. But when I downloaded again my code to the server it didn't show the page. I have created the .crt and .key certificates on the server, and configure the Apache server but with out any luck.

My default-ssl.conf file looks like this:

<IfModule mod_ssl.c>
        <VirtualHost _default_:443>
                ServerAdmin ***@***.com
                ServerName 111.111.111.111

                DocumentRoot /var/www/page/public/

                ErrorLog ${APACHE_LOG_DIR}/error.log
                CustomLog ${APACHE_LOG_DIR}/access.log combined

                SSLEngine on

                SSLCertificateFile      /etc/ssl/certs/apache-selfsigned.crt
                SSLCertificateKeyFile /etc/ssl/private/apache-selfsigned.key

                <FilesMatch ".(cgi|shtml|phtml|php)$">
                                SSLOptions +StdEnvVars
                </FilesMatch>
                <Directory /usr/lib/cgi-bin>
                                SSLOptions +StdEnvVars
                </Directory>
        </VirtualHost>
</IfModule>

After many attempts my 000-default.conf now is like this:

<VirtualHost *:80>
        Redirect "/" "https://www.page.com"
</VirtualHost>

This is the configuration I had when the page was working:

<VirtualHost *:80>
        ServerName page.com
        ServerAdmin webmaster@***.com
        DocumentRoot /var/www/page/public
        <Directory /var/www/page/public>
                Options Indexes FollowSymLinks MultiViews
                AllowOverride All
                Order allow,deny
                allow from all
        </Directory>
        Redirect "/" "https://www.page.com"
        RewriteEngine on
        RewriteCond %{SERVER_NAME} =page.com
</VirtualHost>

<VirtualHost *:80>
        ServerName www.page.com
        ServerAdmin webmaster@page.com
        DocumentRoot /var/www/page/public
        <Directory /var/www/page/public>
                Options Indexes FollowSymLinks MultiViews
                AllowOverride All
                Order allow,deny
                allow from all
        </Directory>
        Redirect "/" "https://www.page.com"
        RewriteEngine on
        RewriteCond %{SERVER_NAME} =page.com [OR]
        RewriteCond %{SERVER_NAME} =www.page.com
</VirtualHost>

Just in case my ssl-params.conf looks like this:

SSLCipherSuite EECDH+AESGCM:EDH+AESGCM:AES256+EECDH:AES256+EDH
SSLProtocol All -SSLv2 -SSLv3 -TLSv1 -TLSv1.1
SSLHonorCipherOrder On
# Disable preloading HSTS for now.  You can use the commented out header line that includes
# the "preload" directive if you understand the implications.
# Header always set Strict-Transport-Security "max-age=63072000; includeSubDomains; preload"
Header always set X-Frame-Options DENY
Header always set X-Content-Type-Options nosniff
# Requires Apache >= 2.4
SSLCompression off
SSLUseStapling on
SSLStaplingCache "shmcb:logs/stapling-cache(150000)"
# Requires Apache >= 2.4.11
SSLSessionTickets Off

I haven't change any configuration of Laravel during this process. The page now shows an error "The page isn’t redirecting properly An error occurred during a connection to www.page.com." So after attempting a lot of things I have run out of ideas and I need this page working.



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire