Johnczek
Johnczek

Reputation: 657

Nginx - generic https and non www redirect

I´ve read a lot of threads about how to redirect www to non-www and how to redirect http to https (like this)

But what I am really trying to achieve is, lets say, more generic way how to handle this (to have https every time and to have non www url every time) for all domains processed by NGINX.

Is there any way how to have some "wildcard" server (or servers) that will

The only thing needed to add some new domain would be then to create ssl server block (without any redirects) that just listens on 443, providing proper certificates and stuff

I´ve tried some settings but I´ve failed every time on a fact there was a https listening server with specific domain- server_name- (to add a proper ssl certificate for this domain) that have overriden the "default" which was handling just stripping www. on https requests (which caused the ssl www. was not redirected until I´ve added that redirect, which is a thing I´d like to perform in generic way for all requests on top nginx level)

Upvotes: 0

Views: 72

Answers (0)

Related Questions