[nginx] nginx missing sites-available directory

I installed Nginx on Centos 6 and I am trying to set up virtual hosts. The problem I am having is that I can't seem to find the /etc/nginx/sites-available directory.

Is there something I need to do in order to create it? I know Nginx is up and running because I can browse to it.

This question is related to nginx centos virtualhost

The answer is


I tried sudo apt install nginx-full. You will get all the required packages.


If you'd prefer a more direct approach, one that does NOT mess with symlinking between /etc/nginx/sites-available and /etc/nginx/sites-enabled, do the following:

  1. Locate your nginx.conf file. Likely at /etc/nginx/nginx.conf
  2. Find the http block.
  3. Somewhere in the http block, write include /etc/nginx/conf.d/*.conf; This tells nginx to pull in any files in the conf.d directory that end in .conf. (I know: it's weird that a directory can have a . in it.)
  4. Create the conf.d directory if it doesn't already exist (per the path in step 3). Be sure to give it the right permissions/ownership. Likely root or www-data.
  5. Move or copy your separate config files (just like you have in /etc/nginx/sites-available) into the directory conf.d.
  6. Reload or restart nginx.
  7. Eat an ice cream cone.

Any .conf files that you put into the conf.d directory from here on out will become active as long as you reload/restart nginx after.

Note: You can use the conf.d and sites-enabled + sites-available method concurrently if you wish. I like to test on my dev box using conf.d. Feels faster than symlinking and unsymlinking.


Examples related to nginx

Kubernetes service external ip pending nginx: [emerg] "server" directive is not allowed here Disable nginx cache for JavaScript files Nginx upstream prematurely closed connection while reading response header from upstream, for large requests Nginx: Job for nginx.service failed because the control process exited How can I have same rule for two locations in NGINX config? How to verify if nginx is running or not? Find nginx version? Docker Networking - nginx: [emerg] host not found in upstream How do I rewrite URLs in a proxy response in NGINX

Examples related to centos

How to uninstall an older PHP version from centOS7 Job for httpd.service failed because the control process exited with error code. See "systemctl status httpd.service" and "journalctl -xe" for details pip install - locale.Error: unsupported locale setting ssh : Permission denied (publickey,gssapi-with-mic) How to change the MySQL root account password on CentOS7? Completely remove MariaDB or MySQL from CentOS 7 or RHEL 7 ffprobe or avprobe not found. Please install one How to check all versions of python installed on osx and centos Cannot find java. Please use the --jdkhome switch VirtualBox: mount.vboxsf: mounting failed with the error: No such device

Examples related to virtualhost

how to create virtual host on XAMPP Site does not exist error for a2ensite nginx missing sites-available directory Apache VirtualHost and localhost Apache error: _default_ virtualhost overlap on port 443 Adding VirtualHost fails: Access Forbidden Error 403 (XAMPP) (Windows 7) client denied by server configuration Apache VirtualHost 403 Forbidden How to debug an apache virtual host configuration? Apache default VirtualHost