Skip to content

Docker newbie3 instructions

Michael Gage edited this page May 5, 2022 · 16 revisions

enabling https access

  • First you need to purchase a domain name and arrange for nameservers to forward that domain name to the IP address on your computer.

  • edit docker-compose.yml

    • hostname: should be uncommented and changed from hostname: localhost to hostname: MyDomainName.com

    • enable the SSL switch SSL: 1 (SSL: 0 or commented line #SSL: 1 disables SSL

    • uncomment or redefine WEBWORK_ROOT_URL

      • WEBWORK_ROOT_URL: https://MyDomainName.com
      • If uncommented, the entry should include http or https e.g. http://localhost or https://myDomain.com
      • The default is `http://localhost (when the line is commented out)
    • in the ports: section

      • comment out # - "${WEBWORK2_HTTP_PORT_ON_HOST}:80"
      • uncomment the port assignments
         "80:80"  
         "443:443"
      
    • turn off the apache server for the computer or reassign the port it listens on to something other 80 and 443. (Alternatively assign the ports used in the docker to alternate ports -- say 8080 and 8443) otherwise you will be informed of port conflicts.

  • edit docker-config/apache/000-default to add a virtual host for your myDomain.com` server

<VirtualHost *:80>
     ServerName MyDomainName.com 
     DocumentRoot /var/www/html
     ErrorLog ${APACHE_LOG_DIR}/error.log
     CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
  • edit docker-config/ssl/default-ssl.conf to add a virtual segment for your myDomain.com server
     <VirtualHost *:443>
                ServerAdmin [email protected]
                DocumentRoot /var/www/michaelegage.com/html/
                ServerName MyDomainName.com
                ServerAlias MyOtherDomainName.net

                UseCanonicalName On

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

                SSLEngine on

                SSLCertificateFile      /etc/ssl/local/apache-selfsigned.crt
                SSLCertificateKeyFile   /etc/ssl/local/apache-selfsigned.key
 
                <FilesMatch "\.(cgi|shtml|phtml|php)$">
                                SSLOptions +StdEnvVars
                </FilesMatch>
                <Directory /usr/lib/cgi-bin>
                                SSLOptions +StdEnvVars
                </Directory>

        </VirtualHost>

  • add certificate and key (or better yet a link to the same) to docker-config/ssl/local