Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am using nginx on ubuntu which by default has the sites-available/enabled directory structure similar to Apache to store the sites configuration files. I have compiled nginx (because I need a third party module) using the below configuration:

./configure \
    --prefix=/opt/nginx/version \
    --http-log-path=/var/log/nginx/access.log \
    --error-log-path=/var/log/nginx/error.log \
    --pid-path=/var/run/ \
    --with-http_ssl_module \
    --user=nginx \
    --group=nginx \

Nginx is working fine, but right now I need to configure all my sites in /opt/nginx/version/conf/nginx.conf which isn't as maintainable as with the sites-available/enabled directory structure whereby I can create 1 file per site and decide which ones are enabled with symlinks.

I had a look at the install options but all I see is --conf-path to specify the path to nginx.conf.

Is there a way to reuse the sites-available/enabled directory structure with a compiled nginx?

share|improve this question
up vote 5 down vote accepted

If you look inside the default Ubuntu /etc/nginx/nginx.conf you ought to find the following line.

http {
    include /etc/nginx/sites-enabled/*;

That is what you need to get the sites-enabled magic happen.

share|improve this answer

I haven't nginx installed on any machine, but I guess that this is handled the same way as in Apache, where the main configuration file just includes all files located in /etc/apache/sites-enabled. These files are in turn just symlinks to files in /etc/apache/sites-available and these links are either manually mananged or with the help of the a2enable script family.

It should be very easy to recreate a similar structure with your self-compiled nginx.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.