Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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/nginx.pid \
    --with-http_ssl_module \
    --user=nginx \
    --group=nginx \
    --add-module=...

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

2 Answers 2

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

 
discard

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.