Cpnginx Templates
Create and Manage Nginx vhost templates in Cpnginx
This section tells you everything about vhost template or app template management in Cpnginx.
Cpnginx uses the Python Mako template language. You may read the template file documentation of Mako properly.
First line of the template file
The first line of the template file must be in the following format.
#:keyword: Description of the Template : version number:
- keyword: This is the unique keyword of the template name, as it is the same as the template file name.
- Description of the Template: This is an explanation to show your clients about the template information. This will help to identify what the template is.
- version number: This will be a unique version number of your template, which will help you track your template
An example is as follows:
#:nginx:Nginx+ PHP-FPM Default Stand Alone:1.0:
This first line is important. It used to show the templates in your Cpnginx interface pages and to build the template pools.
Location of templates
Please see the location of template files below:
| Item | Description |
| /etc/cpnginx/templates/ | The root of all nginx templates |
| /etc/cpnginx/templates/apps/ | Location of default app templates provided by cpnginx |
| /etc/cpnginx/templates/vhost/ | Location of default nginx template, hybrid, vhost, and nginx |
| /etc/cpnginx/templates/fpm/ | The fpm user pool template |
| /etc/cpnginx/templates/custom/ | This is the custom template director for you. |
You may only upload or edit templates in the directory /etc/cpnginx/templates/custom/. All other folders will be updated with the default cpnginx templates.
Default Vhost Templates
Cpnginx runs nginx in three different modes: hybrid, proxy, and nginx. These templates are located under /etc/cpnginx/templates/vhost/ .
- hybrid.conf - Nginx server static files and Apache server dynamic files
- proxy.conf - Nginx works as a proxy in front of Apache
- nginx.conf – It is a standalone nginx with multi-php fpm
Don’t edit these template files. If you need to create a custom template for these templates, copy this file to the custom folder and edit it. An example is given below,
cp /etc/cpnginx/templates/vhost/nginx.conf /etc/cpnginx/templates/custom/nginx.conf
In the above example if you have custom nginx.conf template in your custom folder, the cpnginx by default use only that custom vhost template file for the selected domains or subdomains.