Welcome! Log In Create A New Profile

Advanced

Re: Server_Name regular expression

Maxim Dounin
August 29, 2013 05:38AM
Hello!

On Thu, Aug 29, 2013 at 05:01:01AM -0400, christospap wrote:

> I would like to syntax a regular expression which will match two server
> names. The server names are example.com and www.example.com. In particular,
> a regular expression for www or nothing
>
> I wrote the following regular expression (www\.|)example.com Nginx
> configuration file is compatible with Perl programming language. While it
> should work, it doesn't seem to work. I cannot find the proper regular
> expression. Does anyone have an idea how to synatx the regular expression?

How to use regular expressions in server_name directive is
documented here:

http://nginx.org/r/server_name

Note that regular expressions must be preceeded with "~" to
distinguish them from normal names.

Syntax of regular expressions per se is documented in the PCRE
library manual pages, see "man pcresyntax" for quick syntax
reference.

--
Maxim Dounin
http://nginx.org/en/donation.html

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

Server_Name regular expression

christospap August 29, 2013 05:01AM

Re: Server_Name regular expression

Maxim Dounin August 29, 2013 05:38AM

Re: Server_Name regular expression

Jonathan Matthews August 30, 2013 04:56AM

SV: Server_Name regular expression

Jens Rantil August 30, 2013 06:36AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 297
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