How do I enable/disable a website hosted with Apache?
1 Reply
Hey,
To enable or disable a site hosted with Apache, you can use the 'a2ensite' and 'a2dissite' commands, respectively. Both commands use essentially the same syntax:
a2ensite <site>
a2dissite <site>
where '<site>' is the name of your site's Virtual Host configuration file, located in '/etc/apache2/sites-available/', minus the '.conf' extension. For example, if your site's Virtual Host configuration file is called 'example.com.conf', then the commands would look like</site>
a2ensite example.com
a2dissite example.com
There are other, more complicated ways to do this, but these commands basically just automate those processes anyway, so my advice is to use these commands to ensure that everything is always configured correctly. Also, remember to restart Apache after running those commands. The exact command will depend on which Linux distribution you are using, but will most likely be one of the following 2 commands:
sudo systemctl restart apache2
sudo service apache2 restart
Regards,
Tom D.
Linode Support Team