Welcome! Log In Create A New Profile

Advanced

Re: Matching server host name in location directive

Francis Daly
July 05, 2011 04:06AM
On Tue, Jul 05, 2011 at 11:19:23AM +0530, Quintin Par wrote:

Hi there,

>   I have nginx running multiple domains under a single server directive as
>   server {
>           listen       80;
>           server_name  www.domain.com;
>           server_name  x.domain.com;
<snip>

>   Now, I need to use location directive to match a subdomain and apply basic
>   auth to it. The equivalent of

location doesn't match subdomains. server_name matches subdomains. Use
different server{}s for different things.

>   location x.domain.com {
>           auth_basic "Admin Login";
>          auth_basic_user_file /etc/nginx/.htpasswd;
>   }
>
>   How do I do this using DRY?

make.

Or m4. Or a config file generator of your choice.

nginx doesn't care how your .conf file came about, it just cares about
what is in the .conf file when it is loaded.

Don't worry about duplication or repetition in the generated output
file. If you want to worry about repetition, do it in your input format.

Good luck,

f
--
Francis Daly francis@daoine.org

_______________________________________________
nginx mailing list
nginx@nginx.org
http://nginx.org/mailman/listinfo/nginx
Subject Author Posted

Matching server host name in location directive

Quintin Par July 05, 2011 01:50AM

Re: Matching server host name in location directive

Edho P Arief July 05, 2011 02:54AM

Re: Matching server host name in location directive

Francis Daly July 05, 2011 04:06AM

Re: Matching server host name in location directive

Quintin Par July 05, 2011 04:30AM

Re: Matching server host name in location directive

antituhan July 17, 2011 11:32PM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 182
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready