Help Required: Host name modification.

Sougata Pal. skall.paul at gmail.com
Tue Jul 27 15:28:49 MSD 2010


Hi,

I have tried the following config, but it is generating error while
restarting the server.

*Error: *[emerg]: unknown "new_host" variable

server {
  listen 80;
  server_name ~(?P<new_host>.*)\.xyz\.com;
  error_log "/srv/logs/xyz.com.error";

  gzip on;
  default_type  text/html;

  location / {
    proxy_pass         http://$new_host:80;
    proxy_set_header   Host              $new_host;
    proxy_set_header   X-Real-IP        $remote_addr;
  }
}

On Tue, Jul 27, 2010 at 2:26 PM, Boris Dolgov <boris at dolgov.name> wrote:

> On Tue, Jul 27, 2010 at 10:12 AM, Sougata Pal. <skall.paul at gmail.com>
> wrote:
> > Hi,
> >
> > I need to modify the hostname ( $host ) as follows.
> >
> > Request Hostname:  xyz.abc.example.com
> >
> > Required Hostname:  xyz.abc
> >
> > I am expecting some sort of regex function to be run on $host.
> >
> > Please feel free to ask questions to know more about my requirement.
> server
> {
>    server_name ~(?P<new_host>.*)\.example\.com;
>    location /
>    {
>        proxy_pass ...;
>        proxy_set_header Host $new_host;
>    }
> }
>
> --
> Boris Dolgov.
>
> _______________________________________________
> nginx mailing list
> nginx at nginx.org
> http://nginx.org/mailman/listinfo/nginx
>



-- 
Thanks
Sougata Pal.
http://in.linkedin.com/in/skallpaul
Contact: +91 9051042886
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://nginx.org/pipermail/nginx/attachments/20100727/1a9adc2a/attachment.html>


More information about the nginx mailing list