Wednesday, March 27, 2013

How do I enable or disable an apache virtual host?

To enable an apache virtual host run the following command:
sudo a2ensite example.com
To disable an apache virtual host run the following command:
sudo a2dissite example.com
Both of the examples above assume you're interested in enabling/disabling the site configured via the following file:
/etc/apache2/sites-available/example.com
Lastly, if you're interested in learning more about the a2ensite/a2dissite command, checkout the following notes:
#This manual page documents briefly the a2ensite and a2dissite commands.

#a2ensite  is a script that enables the specified site (which contains a
#<VirtualHost> block) within the apache2 configuration.  It does this by
#creating   symlinks   within   /etc/apache2/sites-enabled.    Likewise,
#a2dissite disables a site by removing those symlinks.   It  is  not  an
#error  to  enable  a  site  which is already enabled, or to disable one
#which is already disabled.

#The default site is handled specially: The resulting  symlink  will  be
#called 000-default in order to be loaded first.

No comments:

Post a Comment

About Me

My photo
I code. I figured I should start a blog that keeps track of the many questions and answers that are asked and answered along the way. The name of my blog is "One Q, One A". The name describes the format. When searching for an answer to a problem, I typically have to visit more than one site to get enough information to solve the issue at hand. I always end up on stackoverflow.com, quora.com, random blogs, etc before the answer is obtained. In my blog, each post will consist of one question and one answer. All the noise encountered along the way will be omitted.