Nginx config in Server Templates

SYSTEM INFORMATION
OS type and version Debian12
Webmin version 2.520
Virtualmin version 7.50.0
Webserver version nginx/1.22.1
Related packages SUGGESTED

Hello

I want to edit a Server Template to include an Nginx snippet.

However, I can’t find where to add this under the options in Server Templates.

Nginx is installed, and all accounts are using it.

I see both “Nginx website” and “Nginx SSL website” enabled under “System Settings → Features and Plugins”

Where do add my snippet to the Nginx config for this template?

Hello,

See “System Settings ⇾ Features and Plugins: Nginx → Configuration” page.

1 Like

Thanks Ilia.

Do I add my snippets under Additional Nginx directives for new virtual hosts ?

Yes, there is the place.

Apologies I misunderstand, but won’t this add it to every new virtual account I setup?

Ideally I’d like to add this snippet to the server block of a specific Server Template, and not every new account.

Won’t this add it globally?

I agree, we should be consistent with how we manage the Nginx webserver, and do it just like we do with Apache.

I remember we talked about it with @Jamie, but I don’t remember why it is like that; let’s see what he says.

The option to define per-template additional Nginx directives already exists though, at System Settings → Server Templates → Default settings → Website for domain.

This is what I see here

Perhaps we’re not seeing the same thing, but where do I enter my Nginx snippets for this template?

Hmm … which version of the Nginx plugin are you using? It’s on the Features and Plugins page in Virtualmin.

Nginx website - 2.36
Nginx SSL website - 1.20

Try checking in the “Plugin options” section of the template

Yes, I can edit it in there, but now we’re back to the original question:

In the Nginx Plugin config, there’s a field for Additional Nginx directives for new virtual hosts but it doesn’t seem like it’s template specific. It’s a general setting for all templates. Ideally, I’d like to be able to specify per template.

Thanks for the engagement

So that “Additional Nginx directives for new virtual hosts” field will apply to all new domains, but the setting in the template on “Plugin options” will apply to only domains created from that template.

It does not exist on the templates yet!

Think I was looking under config only. Let me check on that

@Jamie, it isn’t there either. And, please let’s not make a new super-confusing section for this. We need to inject it into “Website for domain” to be consistent with Apache systems.

To be clear, the “Plugin options” section API is great, and can be useful but definitely not for Nginx.

1 Like

For sure, in fact I already implemented that, and it will be in the 2.37 version of the Nginx plugin that I tagged for release a couple of days ago.

1 Like

OK, very cool, looking forward to trying that out

That’s odd. I have it installed and still don’t see it in the templates. Can you show a screenshot of what you’re seeing? Do you have it working on Debian and Ubuntu systems too?

Did we package the 2.37 version already?