Zend certified PHP/Magento developer

Virtual Host file is giving me a headache!

I finally pointed my domain to the server and now I need to set up the SSL certificate. However, the Virtual Host (on Ubuntu 18.04) is giving me a lot of trouble.

My website is hosted in /var/www/html/ (bad idea?), so this is what my current host file looks like:

<VirtualHost *:80>
    ServerAdmin webmaster@localhost
    ServerName mydomain.com
    ServerAlias www.mydomain.com
    DocumentRoot /var/www/html/pub
    ErrorLog ${APACHE_LOG_DIR}/error.log
    CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>

I first set up DocumentRoot to /var/www/html but it’d open the “Index of/” page. However, when I set it up to /pub, it is functional, but all of my relative paths are messed up. For example, if I had an image that was pointing at /pub/media/images/image1.jpg it is now broken as it’s basically requesting mydomain.com/pub/pub/media/images/image1.jpg

I don’t know much about rewrites, but I’m hoping someone could help me out here?

Thank you!

EDIT: I fixed it! …somewhat. Images are now loading, but the add to cart button is not. Oh god…