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 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…
- 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…
- How To Set Rails On Nginx Ubuntu 18.04 How To Set Rails On Nginx Ubuntu 18.04 Step 1: Install Ruby Using RVM The first step for setting up Ruby on Rails on an Ubuntu 18.04 server with Nginx…
- 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…
- Etc Nginx Sites-Available Default Permission Denied Etc Nginx Sites-Available Default Permission Denied What is Nginx and Why is it Used? Nginx is a powerful and open-source web server software used to host modern web applications. It…
- 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…
- 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…
- 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…
- 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…
- Server Ip Address Could Not Be Found Cloudflare Nginx Server Ip Address Could Not Be Found Cloudflare Nginx What Is Cloudflare? Cloudflare is a content delivery network (CDN) and distributed DNS provider. It provides reverse proxy services for websites…
- 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…
- Error Install Nginx On Ubuntu Error Install Nginx On Ubuntu What is Nginx? Nginx is a web server software used to host web applications. It is open source software developed by the open source community.…
- 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…
- 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…
- Webdav Nginx Ubuntu 16.04 Webdav Nginx Ubuntu 16.04 Introduction to Webdav with Nginx in Ubuntu 16.04 The ever-evolving world of the internet has given us a powerful platform to share information, media, and files…
- How To Disable Directory Listing In Nginx How To Disable Directory Listing In Nginx What is Directory Listing? Directory listing allows a web server or an FTP server to display a list of all the files or…
- 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…
- 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…
- Default Webserver Nginx Ubuntu 18.04 Default Webserver Nginx Ubuntu 18.04 What is Nginx? Nginx is an open source web server that is used to host websites or act as a reverse proxy for other web…
- 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…
- 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 Multiple Web Sites One Ip Nginx Multiple Web Sites One Ip Introduction Nginx is a powerful and popular web server used by millions of websites and web application around the world. It is highly performant,…
- 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…
- Nginx Check Default Client_Max_Body_Size Nginx Check Default Client_Max_Body_Size What is Nginx? Nginx is an open source web server, written in C programming language, created by Russian programmer Igor Sysoev. It’s a fast web server…
- 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…
- 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…
- Cloudhost Deploy Laravel 5.4 To Vps Centos7 Nginx Cloudhost Deploy Laravel 5.4 To Vps Centos7 Nginx Introduction to Deploy Laravel 5.4 to VPS CentOS7 Nginx Laravel is a free open-source framework for web applications. It provides modern and…
- 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…
- 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…
- 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…