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-availabledirectory 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.ddirectory to thesites-availabledirectory:
sudo cp /etc/nginx/conf.d/* /etc/nginx/sites-available/
- Create symbolic links from the
sites-availabledirectory to thesites-enableddirectory for each configuration file:
sudo ln -s /etc/nginx/sites-available/* /etc/nginx/sites-enabled/
- Remove the configuration files from the
conf.ddirectory:
sudo rm /etc/nginx/conf.d/*
- Modify the
includeline in the main NGINX configuration file (/etc/nginx/nginx.conf) to include thesites-enableddirectory instead of theconf.ddirectory:
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.