most efficient way to return on everything but a single directory?

Igor Sysoev igor at sysoev.ru
Tue Nov 8 04:34:12 UTC 2016


On 08 Nov 2016, at 04:14, Jonathan Vanasco <nginx at 2xlp.com> wrote:

> I'm doing a quick audit on an nginx deployment and want to make sure something is implemented correctly
> 
> We have a handful of domains that redirect http traffic to https.
> 
> we used to do this, which is very efficient:
> 
> 	sever {
> 		listen 80:
> 		server_name example.com www.example.com;
> 		return 301 https://www.example.com$request_uri;
> 	}
> 
> now we use SSL certificates via letsencrypt, and need to keep a specific location on port 80 open to proxy into our custom renewal client.
> 
> the only thing I could think of was this:
> 
> 	sever {
> 		listen 80:
> 		server_name example.com www.example.com;
> 
> 		location /letsencrypt/ {
> 			# proxy to client
> 		}
> 		location / {
> 			return 301 https://www.example.com$request_uri;
> 		}
> 	}
> 
> Is there a more efficient way to accomplish the above or is the above the best way?

This is the right way.


-- 
Igor Sysoev
http://nginx.com



More information about the nginx mailing list