Host Multiple Websites with Different Domains (Solved)

Problem Description
I am trying to host a second static website with a different domain.

Steps to Reproduce

  1. Managed to get LetsEncrypt Certificate for a second domain.
  2. Created a virtual host under apache with necessary second domain directory and configuration as described here
  3. Restarted apache2
  4. Cant access my new static website

Expected Results
I expect to be able to host and access multiple domains.

Actual results
I get a “site unavailabe” message in my browser.

Information

  • FreedomBox version: Debian GNU/Linux 11 (bullseye) and FreedomBox version 22.24
  • Hardware: Pi4
  • How did you install FreedomBox?: downloading testing images from https://freedombox.org

Thanks to some remarks from @etienne in regard to overriding the freedombox config files (Reference Post) the issue seems to be solved with the following steps:

  • Introduce your new domain under Plinth > Configure > Domain Name (i.e. custom.com)
    This will trigger LetsEncrypt to obtain a certificate for your new domain
    Once you get the certificate, you may revert back to your initial domain to access FBX.
  • Follow steps in this guide to create the folder structure for your new website.
    When creating your conf file, name it with a prefix of 01- (i.e. 01-custom.com.conf).
  • The contents of your 01-custom.com.conf should be in line with the below:
<VirtualHost *:443>
    ServerName custom.com
    ServerAlias www.custom.com
    ServerAdmin webmaster@custom.com
    DocumentRoot /var/www/custom.com/public_html

    <Directory /var/www/custom.com/public_html>
        Options -Indexes +FollowSymLinks
        AllowOverride All
    </Directory>

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

SSLCertificateFile /etc/letsencrypt/live/custom.com/fullchain.pem
SSLCertificateKeyFile /etc/letsencrypt/live/custom.com/privkey.pem
</VirtualHost>

If you’ve adjusted your DNS settings correctly, you should access custom.com/index.html from the external network.

1 Like