Nginx convert conf.d directory to the sites-available directory setup

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:

  1. Create a sites-available directory if it does not already exist:
sudo mkdir /etc/nginx/sites-available
sudo mkdir /etc/nginx/sites-enabled
  1. Copy the configuration files from the conf.d directory to the sites-available directory:
sudo cp /etc/nginx/conf.d/* /etc/nginx/sites-available/
  1. Create symbolic links from the sites-available directory to the sites-enabled directory for each configuration file:
sudo ln -s /etc/nginx/sites-available/* /etc/nginx/sites-enabled/
  1. Remove the configuration files from the conf.d directory:
sudo rm /etc/nginx/conf.d/*
  1. Modify the include line in the main NGINX configuration file (/etc/nginx/nginx.conf) to include the sites-enabled directory instead of the conf.d directory:
include /etc/nginx/sites-enabled/*;
  1. Restart NGINX to apply the changes:
sudo systemctl restart nginx

This will convert the NGINX server to use the `sites-available directory.

Comment Here

Need WordPress help? Linux Server help? Talk to us.

  • We are your own WordPress customer service.
  • We set up Linux servers and install or migrate WordPress. Learn more here.
  • We support WooCommerce too.
  • Check out our WordPress customer support plans here or contact us below .

If you have any questions regarding WordPress support, Linux server support or any of our services, feel free to reach out or read more on our services page.

Join this free course:

How to host multiple WordPress
websites on a VPS

Close me!