for nginx options it is possible to choose on “File or directory for new virtual hosts” between writing everything into the main config file (which seems to be the default) or to write into per host config files (/etc/nginx/sites-available).
This is my prefered way, after i found it out
Is there any way to switch from global config file to the sites-available if there are already sites on the server?
Like rewriting all of the config files?
And a side question, can i use placeholders in “Additional Nginx directives for new virtual hosts” like
include /home/%vhost%/etc/nginx_site.conf
yes, its possible.
Go to webmin > Servers > Nginx webserver and select the module config. There you will have
File or directory for new virtual hosts (add /etc/nginx/sites-available as the value)
&
Directory for links to new virtual host files (add /etc/nginx/sites-enabled as the custom value)
Disabling the website feature and re-enabling it for the domain should re-generate it in the separate file. But, be careful with that, if you have any customizations in the config file made outside of Virtualmin. It’s possible to script that using the command line interface, as well, if you have a lo of domains you want to do this for.
The command line way to do that quickly for all of your domains:
How many different websites do you have in that nginx config file? Up to about 15–20, just split it with a text editor. Much more than that, write a little script that does the split for you. For example, ask Google [perl script to split a large text file].