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

Jonathan Vanasco nginx at 2xlp.com
Tue Nov 8 01:14:09 UTC 2016


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?





More information about the nginx mailing list