a2ensite for Nginx on Ubuntu

      No Comments on a2ensite for Nginx on Ubuntu

a2ensite is a nice command that creates the symlink needed for an apache config file from sites-available to sites-enabled.

Nginx doesn’t have such a command, but it is quite simple to create the symlink through bash.

Just run this command:

sudo ln -s /etc/nginx/sites-available/mysite.com /etc/nginx/sites-enabled/

 

And reload nginx config

sudo service nginx reload

 

If you want to turn the site off, just remove the symlink.

sudo rm /etc/sites-enabled/mysite.com

 

That will keep the config file in sites-available so you can turn it on again if need be.

Leave a Reply

Your email address will not be published. Required fields are marked *