Adding a new site with Apache

A while back, I started playing with Nextcloud and wrote a bit about it noting that I wondered if I’d use it.
Well I haven’t really, but as many have mentioned to me, the whole self-hosting thing is addictive!
So…I’ve been playing with Jellyfin, Plausible, and VSCode/Coder but I keep forgetting how to set them up.
So far, they’ve all been similar in their configuration and setup with my existing reverse proxy Apache2.
I’m going to quickly document the setup here for future reference.

I definitely don’t know much about Linux, Apache, or reverse proxies whatnot, so this approach could be full of holes.

Use at own risk!

Process #

Expand/Collapse bash

# Add A record in domain DNS

# Maybe needed if not already done
sudo a2enmod proxy proxy_http proxy_ajp remoteip headers ANY_OTHER_PLUGINS
sudo systemctl restart apache2

# create/copy site config
touch /etc/apache2/sites-available/mysite.conf
sudo cp /somepath/mysite.conf /etc/apache2/sites-available/

# Activate site
sudo a2ensite mysite.conf
sudo systemctl restart apache2

# Begin site SSL config
sudo certbot --apache

# Allow SOMEUSER user to access media math
sudo setfacl -m user:SOMEUSER:rxw /PATH
# Add A record in domain DNS

# Maybe needed if not already done
sudo a2enmod proxy proxy_http proxy_ajp remoteip headers ANY_OTHER_PLUGINS
sudo systemctl restart apache2

# create/copy site config
touch /etc/apache2/sites-available/mysite.conf
sudo cp /somepath/mysite.conf /etc/apache2/sites-available/

# Activate site
sudo a2ensite mysite.conf
sudo systemctl restart apache2

# Begin site SSL config
sudo certbot --apache

# Allow SOMEUSER user to access media math
sudo setfacl -m user:SOMEUSER:rxw /PATH

mysite.conf #

<VirtualHost *:80>
    ServerName MY_DOMAIN_NAME

    # This tends to change depending on what the site needs
    ProxyPass / http://localhost:5000/
    ProxyPassReverse / http://localhost:5000/

    ErrorLog /var/log/apache2/MY_DOMAIN_NAME-error.log
    CustomLog /var/log/apache2/MY_DOMAIN_NAME-access.log combined
</VirtualHost>