Sites Available and Sites Enabled Nginx
If you are a web developer or system administrator, you might be familiar with Nginx as a web server with excellent performance and scalability. Nginx is also known as a reverse proxy for HTTP, HTTPS, SMTP, POP3, and IMAP protocols. In this article, we will discuss two critical directories in Nginx: sites-available and sites-enabled.
Introduction
By default, Nginx stores its configurations in the /etc/nginx directory. Inside this directory, you can find the nginx.conf file, which is the main configuration file. However, when you have multiple websites or applications on your server, managing individual configurations can become tedious. This is where sites-available and sites-enabled directories come into the picture.
Sites Available
The sites-available directory contains configuration files for all your websites or applications. Each file is named after the website or application it configures, and it ends with the .conf extension. One of the benefits of having individual configuration files is that you can enable or disable a website without deleting its configuration. Moreover, you don’t have to go through the main configuration file to modify a specific website’s settings.
Generally, the sites-available directory contains configurations for all your websites, including those that are not currently running. It’s a good practice to keep all your configurations in one place, so you don’t forget about them when you need them. In case you have to move your website to a new server or install a new Nginx version, you won’t have to worry about missing configurations.
Sites Enabled
The sites-enabled directory contains symbolic links to the configuration files in the sites-available directory. When you enable a website, Nginx creates a symbolic link in the sites-enabled directory to the respective configuration file in the sites-available directory. As a result, Nginx loads only those configuration files that have symbolic links in the sites-enabled directory.
This mechanism enables you to enable or disable websites without modifying their configuration files. All you have to do is to create or remove symbolic links in the sites-enabled directory. The syntax for creating a symbolic link in Linux is ln -s source_file target_link. For example, to enable a website named example.com, you can run the following command:
ln -s /etc/nginx/sites-available/example.com.conf /etc/nginx/sites-enabled/example.com.conf
Likewise, to disable the same website, you can remove the symbolic link in the sites-enabled directory:
rm /etc/nginx/sites-enabled/example.com.conf
This way, you don’t have to go through the entire configuration file to enable or disable a website.
Conclusion
The sites-available and sites-enabled directories in Nginx are essential for managing multiple websites or applications on your server. The sites-available directory contains all your configuration files, while the sites-enabled directory contains symbolic links to the enabled configurations. This mechanism enables you to enable or disable websites without modifying their configuration files directly. As a result, you can manage your websites efficiently without worrying about complex configurations or dependencies.
Related Posts:
- Perfect Server Ubuntu 18.04 Nginx Perfect Server Ubuntu 18.04 Nginx 1. Introduction Ubuntu is one of the most popular Linux distributions. It is popular due to its user friendliness and availability of excellent free software…
- Docker Nginx Location For Multiple Sites Docker Nginx Location For Multiple Sites If you are a web developer or an IT professional, you know that one of the major headaches in web development is finding a…
- Configuration Nginx On Debian 9 Configuration Nginx On Debian 9 Introduction Nginx is a powerful open source web server that runs on Linux and provides the capability to efficiently serve content. Debian 9 is a…
- Reinstall Nginx Ubuntu 18.04 Reinstall Nginx Ubuntu 18.04 What is Nginx? Nginx is an open source, high-performance web server application designed to serve web traffic with lightning-fast speed and robust stability. Nginx is one…
- Laravel Nginx 404 Not Found Laravel Nginx 404 Not Found What is Laravel? Laravel is an open-source, free PHP web framework which is designed for the development of web applications following the model–view–controller architecture. It…
- Step By Step Install Nginx And Phpmyadmin On Ubuntu Step By Step Install Nginx And Phpmyadmin On Ubuntu Introduction Setting up a web server on Ubuntu is easy and straightforward. Nginx is a popular web server for Ubuntu, and…
- Setup Vhost Nginx Debian 9.3 Setup Vhost Nginx Debian 9.3 Introduction This article will provide step-by-step instructions to setup Nginx Virtual Hosts (vhosts) on a Debian 9.3 system. Nginx is a web server software used…
- Nginx Ubuntu Access Virtual Host From Another… Nginx Ubuntu Access Virtual Host From Another Machine Over LAN Are you trying to access a virtual host set up using Nginx on Ubuntu from another machine over a LAN?…
- Install Nginx Phpmyadmin Ubuntu 18.04 Install Nginx Phpmyadmin Ubuntu 18.04 Introduction to Nginx, PHP, and Ubuntu Nginx is an open-source, high-performance web server written in C and used to serve static and dynamic webpages. It…
- Sites-Enabled Nginx Conf Template Sites-Enabled Nginx Conf Template What is Nginx? Nginx is an open-source web server and reverse proxy used by the likes of Netflix, Ubisoft and WordPress. It is free and can…
- Setting Sites Available Di Nginx Ubuntu Setting Sites Available Di Nginx Ubuntu Understanding Nginx and its Parts Nginx is a great tool for managing web applications. It allows you to host multiple websites, as well as…
- Nginx Directory Index Of Is Forbidden Nginx Directory Index Of Is Forbidden What is Nginx Directory Index of? Nginx Directory Index of is a directive used by the Nginx web server to indicate the location of…
- Nginx Wordpress Ubuntu 18.04 Nginx Wordpress Ubuntu 18.04 Introduction to Nginx Nginx is a web server software for hosting websites and applications. It is open-source and highly configurable, making it a popular choice for…
- How To Install Flask Nginx On Ubuntu 1604 How To Install Flask Nginx On Ubuntu 1604 Introduction Flask is a web application framework based on Python. It is highly useful for web developers due to its flexibility and…
- Nginx Laravel 5.5 500 NGINX Laravel 5.5 500 What is NGINX Laravel? NGINX Laravel is an open source web server and reverse proxy software that is designed to provide robust web hosting services. It…
- Laravel Nginx Without Custom Domain Laravel Nginx Without Custom Domain Overview of Laravel Nginx Without Custom Domain Laravel is an open-source PHP web framework used to create powerful web applications. It is based on the…
- Ignore_Invalid_Headers Directive Is Not Allowed Here… Ignore_Invalid_Headers Directive Is Not Allowed Here In Etc Nginx Sites-Enabled What is the Ignore_Invalid_Headers Directive? The Ignore_Invalid_Headers Directive is a directive in Nginx that specifies whether or not it should…
- Multi Host In Nginx Debian 9 Multi Host In Nginx Debian 9 Introduction Nginx is a web server that can be used for hosting multiple websites on a single server. This guide will help you set…
- Nginx Service Is Failed On Centos 7 Nginx Service Is Failed On Centos 7 Introduction Nginx is an open source Web server and a reverse proxy for HTTP, SMTP, POP3 and IMAP protocols. It can also be…
- Nginx Permission Denied Reading Confguration Nginx Permission Denied Reading Configuration What is Nginx? Nginx is a free, open-source, high-performance HTTP server and reverse proxy. It is the preferred web server for high-traffic websites and is…
- Nginx Static Location For Multiple Django Nginx Static Location For Multiple Django What is Nginx? Nginx is an open source web server written in C that is well-known for its performance and speed. Nginx is one…
- Setup Virtual Hosts In Nginx Setup Virtual Hosts In Nginx Understanding The Virtual Hosts Concept The Virtual Hosts concept is an important part of installing Nginx. It allows you to host multiple websites on a…
- How To Know If Nginx Is Working For A Directory How To Know If Nginx Is Working For A Directory Nginx is a popular open-source web server that is widely used in many websites and applications. It is known for…
- Cannot Get Index.Html Nginx Cannot Get Index.Html Nginx What is Nginx? Nginx is a web server software designed for high-traffic websites and web applications. It is an open source reverse proxy server for HTTP,…
- How To Install Nginx On Debian 10 How To Install Nginx On Debian 10 Overview In this guide, we will show how to install Nginx on a Debian 10 server. Nginx (pronounced “engine-x”) is an open source…
- Nginx Install 3 Version Php Nginx Install 3 Version Php What is Nginx, and What Benefits Does It Provide? Nginx is a server software used to create web applications, present content on the Internet, and…
- Upgrade Nginx Ubuntu 18.04 Upgrade Nginx Ubuntu 18.04 Getting Started with Nginx Ubuntu 18.04 Installation Nginx is a high performance web server and reverse proxy. It is written in C and has ways to…
- How To Configure Virtual Host In Nginx On Centos 7 How To Configure Virtual Host In Nginx On Centos 7 Introduction We all need to configure virtual host on Nginx webserver on CentOS 7 in order to place multiple websites…
- Nginx On Ubuntu 18.04 Nginx On Ubuntu 18.04 What is Nginx? Nginx is a free, open-source, high-performance web server software. It is known for its stability, rich feature set, simple configuration, and low resource…
- Nginx Proxy_Pass Cannot Display Page Nginx Proxy_Pass Cannot Display Page Understanding the Issue When setting up a web server such as Nginx, an issue that is commonly encountered is "proxy_pass cannot display page". This error…