I Would Like to Have All Domains in /var/www

So, I have just created a Virtualmin LEMP Setup but I would like to have all my sites in /var/www/ (or like /var/www/example.com/public_html).
Also, have new domains/vhosts create a separate server block in conf.d rather adding to the default nginx.conf. I will only be adding an ‘include’ directive to nginx.conf (eg. include /etc/nginx/conf.d/*.conf;)
Can anyone direct me how I can achieve this? I am only using the main user/root login and DNS and mail are handled on a different server so i don’t need additional Webmin logins.
Thanks for you help in advance!

I know you can move the default /home for new virtual hosts, either try Server Templates or Virtualmin Configuration. However, if you want to maintain /home as the location for your mails, backups, etc but move public_html to /var/www, then I’m not sure how you can automate that.

The nginx module does allow you to separate config files per virtual host, just click on the gear for configuration.

Thank you for your recommendation. I do not have any mail or DNS on this server so any way to automate would definitely be appreciated. I clicked on the gear and added location for server blocks under “File or directory for new virtual hosts” and in Webmin>Servers>Nginx under the “Document Options” I added the default root directory, however this did not create the site files in /var/www but it still created it in /home/user/. Any idea how I can have all site created in var/www?
Actually, i just noticed something said from an old post from 2009.
Since Virtualmin creates user accounts but I am the only user with multiple sites, would I rather use Webmin instead of Virtualmin for this case?

To change /home to /var/www for new domains, go to Virtualmin > System Settings > Virtualmin Configuration. Change defaults under Home directory base.

To separate Nginx conf per virtual host, go to Nginx Module Configuration and change File or directory for new virtual hosts. Make sure to create this directory too, I usually put them under /etc/nginx/sites.

I use Virtualmin all the time even though I’m just a single user, take advantage of the automation it provides.

1 Like

I kinda thought that’s what it was. I just weren’t sure. Thank you!

I absolutely think so too. I will continue using Virtualmin for the automation, now that you mention it. Thanks again!