How to enable or disable a site, hosted with Apache

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 ‘’, then the commands would look like</site>


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 

Blog Author Yogiraj Avatar

Author: Yogiraj

Raj is a Top Rated full stack web developer and is a very good technical writer. He is a veteran of Digital Marketing and Web development and having expertise in WordPress, Codeigniter, Core PHP Applications, Mysql and excellent in debugging the codes. Being a veteran in web development Raj has extensive knowledge of various technical aspects of web development, which he always shares in his blogs so that others can be benefited from his experience.

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

Reflective Teaching
Reflective Teaching

Reflective teaching means looking at what you do in the classroom, thinking about why you do it, and thinking about if it works – a process of self-observation and self-evaluation.

Read full article
Jurisprudential Inquiry Model

(Learning to think about social policy).
Social values legitimately conflict with one another.
Negotiations of Difference can help to resolve complex and controversial issues.

Read full article
Characteristics of constitution of India
Characteristics of constitution of India

Constitution of India is a scared document. Indian constitution includes the characteristics of main Constitutions of World. Indian Constitution is a result of continues attempt, study, discussion, thinking and hard work of drafting committee during the period of 2 years 11 month and 18 days.

Read full article
Advanced organiser model and its education implication
Advanced organiser model and its education implication

If we connect new information/knowledge to previous knowledge then it helps to understand easily and also to remember for a long time. To prevent introduction in terms of statement or to present material before teaching a lesson is called ‘Advanced Organizer’.

Read full article