Redirects in nginx are really powerful, here are some cool and common examples.
all domains http > https and remove www Redirect all http traffic which has no other better matching server_name defined from www.domain.tld and domain.tld to https://domain.tld
# redirect http://www to https non www # global and maybe not the best in all setups server { listen 80; server_name ~^(www\.)(?<domain>.+)$; return 301 https://$domain$request_uri; } http > https Redirect all of the incoming http requests to https for selected domains