How do I enable/disable a website hosted with Apache?

Linode Staff
Right now I have a website hosted on my Linode with Apache that I don't want displayed but don't want to necessarily destroy any configurations on. I just want to turn it off for now. How do I just disable the website in 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

Reply

Please enter an answer
Tips:

You can mention users to notify them: @username

You can use Markdown to format your question. For more examples see the Markdown Cheatsheet.

> I’m a blockquote.

I’m a blockquote.

[I'm a link] (https://www.google.com)

I'm a link

**I am bold** I am bold

*I am italicized* I am italicized

Community Code of Conduct