Difference between revisions of "Return (nginx.conf)"

From wikieduonline
Jump to navigation Jump to search
 
(12 intermediate revisions by 2 users not shown)
Line 1: Line 1:
{{Draft}}
+
{{lowercase}}
  
<pre>
+
* http://nginx.org/en/docs/http/ngx_http_rewrite_module.html
server {
+
 
    listen 80 default_server;
+
 
 +
[[HTTP]] to [[HTTPS]] redirection example:
 +
 
 +
server {
 +
    [[listen]] 80 default_server;
 +
    [[server_name]] _;
 +
    [[return 301]] https://$host$[[request_uri]];
 +
}
 +
 
 +
[[Subdomain redirection]]: https://stackoverflow.com/questions/45318758/nginx-variable-for-subdomain
 +
server {
 +
    [[listen]]      80;
 +
    [[server_name]]  ~^(?<my[[subdomain]]>.+)\.example\.com$;
 +
    [[return]]      301 http://example.com/$mysubdomain$[[request_uri]];
 +
}
  
    server_name _;
 
  
    return 301 https://$host$request_uri;
 
}
 
</pre>
 
  
 
== Related terms ==
 
== Related terms ==
 
* [[Configure HTTP to HTTPs redirection with Nginx]]
 
* [[Configure HTTP to HTTPs redirection with Nginx]]
 
* [[AWS ALB]]: [[Redirect (AWS::ElasticLoadBalancingV2::Listener)]]
 
* [[AWS ALB]]: [[Redirect (AWS::ElasticLoadBalancingV2::Listener)]]
 +
* <code>[[rewrite]]</code>
  
 
== See also ==
 
== See also ==

Latest revision as of 22:01, 20 October 2021

Advertising: