Virtualmin hook to set Nginx config when creating/editing/deleting a virtualserver.
It only work with virtualservers created after installed a version of webmin-virtual-server >= 6.01.gpl-3.
As root run:
cp virtualmin-nginx-hook /usr/local/bin/virtualmin-nginx-hook
mkdir /usr/local/etc/nginx-templates
cp -r nginx-templates/* /usr/local/etc/nginx-templates/
mkdir /usr/local/etc/nginx-logrotate-templates
cp -r nginx-logrotate-templates/* /usr/local/etc/nginx-logrotate-templates/
Verify that NGINX_SITES_AVAILABLE_DIRECTORY
and NGINX_SITES_ENABLED_DIRECTORY
directories exists.
Verify also that NGINX_LOGS_FOLDER
exists.
Now login to virtualmin with a user with root privileges and:
- Go to System Settings -> Virtualmin Configuration.
- Select the Actions upon server and user creation category.
- In the Command to run after making changes to a server field, enter
/usr/local/bin/virtualmin-nginx-hook
. - Click Save.
You can specify a custom nginx and nginx-logrotate template for a virtualserver.
You only have to set the description of the virtualserver using this patterns:
[nginx-template custom-template-name] [nginx-logrotate-template custom-logrotate-template]
With previous example (if default script config is not modified), the following files must exists:
/usr/local/etc/nginx-templates/custom-template-name/plantilla-nginx-ssl.conf
/usr/local/etc/nginx-templates/custom-template-name/plantilla-nginx.conf
/usr/local/etc/nginx-logrotate-templates/custom-logrotate-template/logrotate-nginx.conf
If custom template is not found, default template will be used instead.