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:
- 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…
- Nginx Reverse Proxy Etc Default Nginx Reverse Proxy Etc Default What is a Nginx Reverse Proxy? An Nginx reverse proxy is a type of web server that relays client requests from one server to one…
- 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…
- Instal Nginx Ubuntu 18.04 Installing Nginx on Ubuntu 18.04 What is Nginx? Nginx is a lightweight, open source, high-performance web server designed for serving dynamic and static web content. It is capable of handling…
- Move On Nginx Web Root To A New Location Laravel Move On Nginx Web Root To A New Location Laravel Introduction Nginx is a web server and reverse proxy for sites running on the web. It’s fast and efficient, and…
- There Are No Sites-Available Folder Nginx . There Are No Sites-Available Folder Nginx What is Nginx Server? Nginx is an open-source web server that is used to deliver webpages to users. It is a free and…
- Setting Serverblock For Domain Using Nginx On Ubuntu 18.04 Setting ServerBlock For Domain Using Nginx On Ubuntu 18.04 Introduction Nginx is a powerful open-source web server that can be used for serving static, dynamic websites and applications. Nginx is…
- 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…
- Nginx Tuning For Best Performance Nginx Tuning For Best Performance What is Nginx? Nginx (pronounced "engine x") is an open source web server and reverse proxy server for HTTP, SMTP, POP3 and IMAP protocols. It…
- 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…
- Nginx Link Sites-Available Sites-Enabled Nginx Link Sites-Available Sites-Enabled What is Nginx? Nginx is a web server used by many websites nowadays, especially due to its flexibility and scalability. It is used to serve multiple…
- Nginx 1.14 Create Virtual Host Nginx 1.14 Create Virtual Host Overview Virtual hosting is a process for hosting multiple websites on a single physical server and IP address. Nginx version 1.14 is the most recent…
- 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…
- 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…
- Nginx Read Php Files Outside Root Nginx Read Php Files Outside Root Understanding the Basics of Nginx Nginx is an open source web server and HTTP proxy server originally developed by Igor Sysoev. It can be…
- 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…
- 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…
- 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…
- Nginx How To Override Nginx.Conf Conf.D Nginx How To Override Nginx.Conf Conf.D What is Nginx? Nginx is a high-performance web server that is commonly used for web hosting and reverse proxies. It has become increasingly popular…
- Cara Install Nginx Debian 4.9 Cara Install Nginx Debian 4.9 Introduction Debian 4.9 is a major release of the Debian Linux-based operating system. It is the first major version of the operating system to be…
- How To Install Nginx Ubuntu How To Install Nginx Ubuntu What is Nginx? Nginx is an open-source web server, reverse proxy, load balancer, and HTTP cache solution with a strong focus on speed and performance.…
- Setting Phpmyadmin Di Nginx Debian 9 Setting Phpmyadmin Di Nginx Debian 9 Introduction Nginx is a popular web server created for Unix-like operating systems like Debian. It is used for many web-related activities such as serving…
- Nginx Sites Enabled Location Sundi3yansyah Nginx Sites Enabled Location Sundi3yansyah What Is Nginx? Nginx is a web server created by Igor Sysoev in 2004. It has become one of the most popular web servers around…
- Not Etc Nginx Sites-Enabled Not Etc Nginx Sites-Enabled Importance of Nginx Sites-Enabled Nginx is a Web Server software used to deliver web content over the Internet. It is mainly used to provide a secure…
- Install Nginx And Apache Debian Install Nginx And Apache Debian Requirements First, you will need to install the packages necessary to run Apache and Nginx on a Debian server. Debian's package manager, “aptitude”, is capable…
- Setup Https Nginx For Node Js Setup Https Nginx For Node Js Introduction to HTTPS and Nginx HTTPS (Hyper Text Transfer Protocol Secure) is an industry standard, encrypted protocol used to establish a secure connection between…
- 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…
- 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?…
- Nginx 1.10 3 Ubuntu Nginx 1.10 3 Ubuntu Overview of Nginx Nginx (“engine x”) is an open source web server created by Russian software engineer Igor Sysoev and launched in 2004. It is used…
- Nginx Ssi Inside Ssi Config Nginx SSI Inside SSI Config What is Nginx SSI? Nginx SSI (Server Side Includes) is an Apache web server module that enables users to embed dynamic HTML content into a…