Apache2 Virtual Host ETC changes not working

Recently one of my new private projects I’ve decided to change the public HTML folder path in my virtual host file, however, no matter how many times i’ve made the changes, refresh and perform any technical change or command I couldn’t see the changes apply. My default path was “/var/www/html/” and I’ve decided to make another sub folder (my mistake, but no worries we’ll fix that) but the changes to the domain virtual host path, just didn’t apply and i kept receiving the older index.html file no matter what.

First things first, don’t forget to restart your apache2 server with the following command.

service apache2 reload

if above command doesn’t apply your changes, it’s likely that you apply those changes in your http virtual host domain and forget to apply those changes inside your SSL configuration as well.

Within your SSH try to search for your domain SSL configuration in the following path:

vim /etc/apache2/sites-available/<your domain>-le-ssl.conf

Apply your changes in your ssl configuration as well. if that doesn’t help, don’t forget to restart your apache2 service. if that doesn’t help, let’s continue

The next solution consider the implementation of apcahe2, Where we host virtual host files inside “sites-available” folder and they are symbolic from another folder which called “sites-enabled”. this folder, is the actual folder that expose virtual host configuration to the public. Meaning that if you configuration something inside sites-available and they are not symbolic linked inside “sites-enabled” it means your configuration won’t work!

There are two reasons for that, you or someone else deleted or changed the symbolic link or you haven’t executed a2ensite command on your virtual host files, Try the following command on your domain inside sites-available to expose your virtual host files:

sudo a2ensite your_domain_1.conf

if noting works, i’d recommend you to test the configuration of your virtual host file with the following command:

sudo apache2ctl configtest

It will try to test your configuration and look for syntax errors.

Leave a Reply

Your email address will not be published. Required fields are marked *

All rights reserved 2024 ©