HTTPS/SSL with Apache

From Mayan EDMS Wiki
Jump to: navigation, search

Instruction to create an Apache 2 named virtualhost on Ubuntu 18.04

  • Create a DNS entry to point at your domain. This example uses mayan.example.com, change that to a real domain you control.
  • Create an Apache virtualhost by creating the file /etc/apache2/sites-available/001-mayan-edms.conf
    <VirtualHost mayan.example.com:80>
            ServerName mayan.example.com
            ServerAdmin info@mayan.example.com
    	ProxyPass / http://localhost:8000/
    </VirtualHost>
  • Test the configuration
    sudo apache2ctl configtest
  • Enable the Apache site for Mayan
    a2ensite 001-mayan-edms.conf
    sudo systemctl reload apache2
  • Install Certbot
    sudo add-apt-repository ppa:certbot/certbot
    sudo apt install python-certbot-apache
  • Execute certbot
    sudo certbot --apache -d mayan.example.com
  • A new apache site should have been created at /etc/apache2/sites-available/001-mayan-edms-le.conf and the previous site file edited to add a redirect.
  • Edit Mayan's supervisor file and change this line
        MAYAN_ALLOWED_HOSTS='["*"]',

to this:

    MAYAN_ALLOWED_HOSTS='["localhost", "127.0.0.1", "[::1]"]',
  • Restart Mayan
    sudo systemctl restart supervisor
  • Test the HTTPS support, visit.
    https://www.ssllabs.com/ssltest/analyze.html?d=mayan.example.com