Last updated on December 16th, 2022 at 10:54 pm.
To convert an NGINX server from using the conf.d
directory to the sites-available
directory to store configuration files, you can follow these steps:
- Create a
sites-available
directory if it does not already exist:
sudo mkdir /etc/nginx/sites-available sudo mkdir /etc/nginx/sites-enabled
- Copy the configuration files from the
conf.d
directory to thesites-available
directory:
sudo cp /etc/nginx/conf.d/* /etc/nginx/sites-available/
- Create symbolic links from the
sites-available
directory to thesites-enabled
directory for each configuration file:
sudo ln -s /etc/nginx/sites-available/* /etc/nginx/sites-enabled/
- Remove the configuration files from the
conf.d
directory:
sudo rm /etc/nginx/conf.d/*
- Modify the
include
line in the main NGINX configuration file (/etc/nginx/nginx.conf
) to include thesites-enabled
directory instead of theconf.d
directory:
include /etc/nginx/sites-enabled/*;
- Restart NGINX to apply the changes:
sudo systemctl restart nginx
This will convert the NGINX server to use the `sites-available
directory.
Discover more from Bizanosa
Subscribe to get the latest posts sent to your email.