Nginx missing sites-available directory in the Nginx configuration directory

Nginx missing sites-available directory in the Nginx configuration directory

Date: 03-04-2021

Once you installed Nginx on Centos 7 to set up virtual host files, you are unable to find the /etc/nginx/sites-available in /etc/nginx directory. You can follow the below steps to enable this option.

Step 1: Create the below directories in the nginx configuration directory. /etc/nginx/sites-availabe and /etc/nginx/sites-enabled.

Step 2: Open /etc/nginx/nginx.conf file and edit to add blow line in http block.
include /etc/nginx/sites-enabled/*;

Step 3: Restart the nginx service by using below command
#systemctl restart nginx

Step 4: Now you can create vhost file inside sites-available and you can create a symlink for them inside sites-enabled for those you want enabled.

Step 5: If you prefer a more direct approach to create vhost file without symlinking between sites-available and sites-enabled, you can follow below steps.
1. Create the conf.d directory in /etc/nginx if it doesn’t already exist and make sure to give it the right permissions/ownership like root or www-data.
2. Open /etc/nginx/nginx.conf file and edit to add blow line in http block.
include /etc/nginx/conf.d/*.conf;
3. Create your separate config files like domain name.conf into the directory conf.d
4. Restart the nginx service.

Thank you!

admin

Our team has expertise across software and web development, WordPress, e-commerce, mobile applications, UI/UX, cloud and infrastructure, DevOps, CI/CD, API integration, security, testing, automation, and technical support. The team also works with AI-based software solutions, LLMs, AI workflows, AI agents, and intelligent application development to help businesses automate processes and build smarter digital solutions. We focus on developing, deploying, maintaining, and optimising secure, scalable, and reliable technology solutions while helping businesses adopt modern technologies and drive digital transformation.

Leave a Reply

Scroll to Top