User selectable Nginx templates (SKINS)

Version 1.62.0


This feature is part of the "DirectAdmin Pro Pack" ==== New command: CMD_NGINX_TEMPLATES Feature allowing Users to select from pre-made templates to be inserted into the nginx server entries for common scripts like WordPress. List of templates can be managed through DA. This is a JSON-only feature (Enhanced will not have it, Evolution will have it) It will apply only to domains, and not to subdomains (similar to E-Mail accounts) Should you need an nginx template on a subdomain, create it as a full domain instead. ================================================== VIEW To view the list of nginx templates, and to view the current locations the domain: CMD_NGINX_TEMPLATES method: GET OUTPUT (eg) { "locations": { "/wordpress": { "nginx_template": "wordpress_with_fastcgi_cache" } }, "settings": { "domain_nginx": "0", "nginx": "1", "nginx_proxy": "0" }, "templates": { "wordpress_with_fastcgi_cache": { "name": "WordPress", "path": "/etc/nginx/templates/wordpress_with_fastcgi_cache.conf" } } } ---- The domain_nginx setting will be set to 1 when: directadmin.conf has: nginx=0 nginx_proxy=1 AND /usr/local/directadmin/data/users/fred/domains/ has: nginx=1 Related: If you have both settings[nginx] and settings[domain_nginx] as 0 (but nginx_proyx=1), then you'd need to throw a warning (no POSTs will be accepted), telling the User to enable domain nginx=1 via the only_affect=nginx option: ================================================== SAVE To set a given location to a template, run: CMD_NGINX_TEMPLATES method: POST action=save location=/wordpress nginx_template=wordpress_with_fastcgi_cache ================================================== DELETE To clear a list of template locations: CMD_NGINX_TEMPLATES method: POST action=delete select1=/wordpress (select2=/otherpath) ================================================== TOKENS Global token: HAVE_NGINX_TEMPLATES=yes|no if the feature is available in the current license. ================================================== TEMPLATES CustomBuild will manage the templates in: /etc/nginx/templates/*.conf The format of the template will be a standard nginx code to be inserted into an nginx location block. The first line of the template is a data line, and should contain something like this: #INFO=name=WordPress where everything after the #INFO= string is url-encoded, allowing for extra vars in the future. If you do not specify the name, DA will name it the name of the file, less .conf (wordpress_with_fastcgi_cache) Before the Include to this file, dA will set the $template_location variable to "/wordpress" (for example), which can be used in the Included template conf. location ~ ^(/wordpress)(/.*)?$ { set $template_location "$1/"; Include /etc/nginx/templates/wordpress_with_fastcgi_cache.conf; include /usr/local/directadmin/data/users/testuser/nginx_php.conf; } ================================================== DATA DirectAdmin will store the list of locations in: /usr/local/directadmin/data/users/USERNAME/domains/DOMAIN.COM.locations.json which is a json file, listing each location. each location is an array, and the sub-item that applies here would be the template name, eg: { "/wordpress" : { "nginx_template" : "wordpress_with_fastcgi_cache" } } as this leaves other options which could be set for that location in the future.

Try DirectAdmin with a 30-day money back guarantee!