Linux || Configure ssl https on docker - mpaz-redstage/magento-snippets GitHub Wiki

This procedure works with the images viniciusbord9/magento1 and viniciusbord9/magento2

  • config port 443 on docker-compose and restart your docker
  • run as SUDO on docker
  • create the folder ssl on /etc/apache2/ssl/
  • open the folder /etc/apache2/ssl/ and run: openssl req –new –newkey rsa:2048 –nodes –keyout server.key –out server.csr
    and sudo openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout /etc/apache2/ssl/apache.key -out /etc/apache2/ssl/apache.crt
  • enable ssl on docker: a2enmod ssl
  • create vhost for ssl:
<VirtualHost *:80>
  ServerAdmin [email protected]
  DocumentRoot /var/www/html/
  <Directory /var/www/html/>
  Options FollowSymLinks
  AllowOverride All
  Order allow,deny
  allow from all
  </Directory>

  ErrorLog /var/log/apache2/magento-error_log
  CustomLog /var/log/apache2/magento-access_log common
</VirtualHost>

<VirtualHost *:443>
  ServerAdmin [email protected]
  DocumentRoot /var/www/html/
   SSLEngine on
   SSLCertificateFile /etc/apache2/ssl/apache.crt
   SSLCertificateKeyFile /etc/apache2/ssl/apache.key
  <Directory /var/www/html/>
  Options FollowSymLinks
  AllowOverride All
  Order allow,deny
  allow from all
  </Directory>
  ErrorLog /var/log/apache2/magento-error_log
  CustomLog /var/log/apache2/magento-access_log common
</VirtualHost>
  • reload apache service apache2 reload

If you see this error when you try to load the store on browser: NET::ERR_CERT_AUTHORITY_INVALID you need to click on Advanced and select that you accept the risks

⚠️ **GitHub.com Fallback** ⚠️