Welcome! Log In Create A New Profile

Advanced

Re: Help Required: Host name modification.

Sougata Pal.
July 27, 2010 07:32AM
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@dolgov.name> wrote:

> On Tue, Jul 27, 2010 at 10:12 AM, Sougata Pal. <skall.paul@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@nginx.org
> http://nginx.org/mailman/listinfo/nginx
>



--
Thanks
Sougata Pal.
http://in.linkedin.com/in/skallpaul
Contact: +91 9051042886
_______________________________________________
nginx mailing list
nginx@nginx.org
http://nginx.org/mailman/listinfo/nginx
Subject Author Posted

Help Required: Host name modification.

Sougata Pal. July 27, 2010 02:16AM

Re: Help Required: Host name modification.

Boris Dolgov July 27, 2010 05:02AM

Re: Help Required: Host name modification.

Sougata Pal. July 27, 2010 07:32AM

Re: Help Required: Host name modification.

Maxim Dounin July 30, 2010 06:26PM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

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