How to enable or disable a site, hosted with Apache

by Yogi P - November 10, 2021

Enable or disable a site, hosted with Apache

In Apache web server different virtual host can be created to host different sites. These virtual hosts/sites can be disabled or enabled as required. To enable or disable a site hosted with Apache, you can use the ‘a2ensite’ and ‘a2dissite’ commands, respectively. Both these commands are almost same in syntax:

a2ensite <site>
a2dissite <site>

In this the ‘<site>’ is the name of the site’s Virtual Host configuration file, which is located in ‘/etc/apache2/sites-available/’, without the ‘.conf’ extension.

For example, if your site’s Virtual Host configuration file is called ‘your-website.com.conf’, then the commands would look like</site>

a2ensite your-website.com
a2dissite your-website.com

These commands work perfectly and ensure that everything is always configured correctly.

Always 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 

Share on: Share YogiRaj B.Ed Study Notes on twitter Share YogiRaj B.Ed Study Notes on facebook Share YogiRaj B.Ed Study Notes on WhatsApp

Suggested Posts

Popular Posts

PHP date format

September 17, 2023

What is SQL used for?

January 21, 2023

What is rollback in Sql

January 17, 2023

What is PHP

December 31, 2022
Latest Posts

Tables 11 to 20

March 11, 2024

Tense Chart

December 22, 2023

Table of 13

December 20, 2023

Table of 3

December 19, 2023
Search this Blog
Categories