Nginx Virtual Host Custom Templates

americanintel

Verified User
Joined
Mar 1, 2004
Messages
135
Location
Granbury, TX
In /usr/local/directadmin/data/users/username/ngninx.conf it states:

# Auto generated nginx config file by DirectAdmin version 1.45.4
# Modifying this file is not recommended as any changes you make will be
# overwritten when the user makes any changes to his/her website

# For global config changes that affect all Users, see this guide:
# http://help.directadmin.com/item.php?id=2
# For local config changes that only affect one User, see this guide:
# http://help.directadmin.com/item.php?id=3

However these help files are geared towards Apache.

We need some custom templates so we don't have to redo the nginx.conf files when DA overwrites them. The changes are simple but could become time consuming once we have more than a few and can cause downtime.

For example, we have some 'rewrites':

Code:
        location / {
                try_files $uri $uri/ /index.php$is_args$args;
        }
        # deny access to apache .htaccess files
        location ~ /\.ht {
                deny all;
        }
        include /etc/nginx/webapps.conf;
}

and some default root directory changes.

Code:
 root /home/username/domains/domain.net/public_html/public;

How would we go about creating templates for Nginx?
 
Hello,

All the templates are still located in /usr/local/directadmin/data/templates/

1. Find what you need in /usr/local/directadmin/data/templates/
2. Copy it to /usr/local/directadmin/data/templates/custom/
3. Modify them in /usr/local/directadmin/data/templates/custom/

rewrite existing virtual hosts, and that's it.
 
Back
Top