Let's break down the process in detail:
When NGINX starts up, it looks for configuration files in the /etc/nginx/sites-enabled
directory. By creating a symbolic link from the sites-available
directory to the sites-enabled
directory, you effectively enable the configuration file without duplicating it.
Here's a step-by-step explanation of creating the symbolic link:
-
Open a terminal or command prompt.
-
Use the following command to create the symbolic link:
sudo ln -s /etc/nginx/sites-available/my-react-app /etc/nginx/sites-enabled/
ln
is the command for creating links.-s
specifies that the link should be symbolic (symlink)./etc/nginx/sites-available/my-react-app
is the path to the configuration file you created in Step 1./etc/nginx/sites-enabled/
is the destination directory where the symlink will be created.
-
After running the command, the symbolic link will be created in the
sites-enabled
directory, pointing to the configuration file in thesites-available
directory.
Creating this symbolic link allows NGINX to recognize and include the configuration file when it starts up or reloads its configuration. It's a way of enabling the configuration without modifying the main NGINX configuration file directly.
Once the symlink is created, you can proceed with testing the NGINX configuration and restarting NGINX to apply the changes.