Tweet: How To Enable/Disable The Site Or Virtual Host In Nginx [] Read this full article.

how to enable/disable the site or virtual host in Nginx

Enable/disable the site or virtual host in Nginx

Apache provides a command that provides a simplex of our virtual hosts available in sites that are available to sites-enabled directories. However, Nginx is a lightweight server. It does not have any in-built command that we can use to automatically create symlinks. Therefore, we have to manually empathize with many of our sites. Let’s first find out how to enable sites in Nginx.    

Enabled site in NGINX

To enable a specific virtual host file, we have to use the ln command to create a symlink. A symlink is like a shortcut to the original file. This means that you simply can edit your virtual host file inside the sites-available directory and therefore the changes also will be implemented within the sites-enabled directory.
Let’s create a symbol of one of our example sites from the sites-available directory to the sites-enabled directory. To perform this task, execute the subsequent command.

$ ln -s /etc/nginx/sites-available/ /etc/nginx/sites-enabled/

The website will not be enabled to create symbols. We have to restart the Nginx server to implement the changes. To restart the Nginx server, execute the subsequent command.

$ sudo service nginx restart

Now let us see how to disable the site in Nginx.

disable site  in NGINX

To disable a site in Nginx, all we need to do is remove the symlink we created when enabling the virtual host file. We can use the regular rm command to remove seams. For example, to disable our site, all we need to do is execute the following command.

$ sudo service nginx restart

To implement the changes we have made, we have to restart the Nginx server. Then, execute the following command to restart the Nginx server to implement the changes.

$ sudo service nginx restart

So, this is often how you’ll enable and disable sites on Nginx.

Conclusion: Nginx is one of the simplest web servers available for free of charge. And it provides all the features we’d like to host multiple domains on our VPS.  you can find advanced settings and instructions from the Nginx official documentation. Nginx provides lots and lots of features that you can use to further correct your configuration.
If you find this post helpful, Share this post  & Tweet this post. 


Share on facebook
Share on twitter
Share on linkedin
Share on whatsapp

Leave a Comment

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