Prestashop 8 docker with Apache reverse proxy

1 min read
  • Start a Prestashop 8 docker instance, ip address 10.10.10.5 port 80 in our example
  • Obtain and configure cert stuff/DNS for your Apache frontend (reverse proxy) - prestashop.mydomain.com in our example
  • Configure and enable virtual hosts for http with https redirection and https at your Apache frontend (reverse proxy)
Show code
<VirtualHost *:80>
   ServerName prestashop.mydomain.com
   Redirect permanent / https://prestashop.mydomain.com/
</VirtualHost>

<VirtualHost *:443>
  ServerName prestashop.mydomain.com

  ProxyPreserveHost On
  ProxyPass / http://10.10.10.5/
  ProxyPassReverse / http://10.10.10.5/

  # Headers to manage reverse proxy
  RequestHeader set X-Forwarded-Proto "https"
  RequestHeader set X-Forwarded-Port "443"

  CustomLog ${APACHE_LOG_DIR}/prestashop_access.log vhost_combined
  ErrorLog ${APACHE_LOG_DIR}/prestashop_error.log

  SSLCertificateFile /etc/letsencrypt/live/....
  SSLCertificateKeyFile /etc/letsencrypt/live/....

</VirtualHost>
  • Visit https://prestashop.mydomain.com and proceed with installation steps online. Select SSL enabled during setup.
    • If you skip/forget SSL, you can update database later:
      • Table ps_configuration
        • PS_SSL_ENABLED --> 1
        • PS_SSL_ENABLED_EVERYWHERE --> 1
  • That way, we manage to get proper access to admin and shop pages both, without any ERR_TOO_MANY_REDIRECTS problem