Variable $1 is Empty
António P. P. Almeida
appa at perusio.net
Thu Oct 14 16:36:43 MSD 2010
On 14 Out 2010 11h56 WEST, suryo.dinoto at gmail.com wrote:
> Hi everyone,
>
> This is my first time installing nginx. I install it on my Debian
> 5.0.3 VPS and use Debian's repository to install it (version:
> 0.6.32).
>
> I'm having problem with using regular expression at server_name.
> Here's my configuration:
>
> server {
> listen 80;
> server_name ~^(.+)\.mydomain\.com$;
> location / {
> root /home/$1/public_html;
> index index.html index.htm;
> }
> }
According to http://nginx.org/en/docs/http/server_names.html you need
version >= 0.7.40 in order to use regex with capturing groups in
server_name. Apart from that your config seems correct.
--- appa
More information about the nginx
mailing list