Welcome! Log In Create A New Profile

Advanced

Subdomain redirect help

Floren Munteanu
May 09, 2009 01:10AM
Hi all,

I have 2 servers, one with development stuff and one with live data. I
also have 4 static IPs available. Right now, one of them is used to
point domain.com to the proper server. My goal is to redirect
www.domain.com to 192.168.1.3 and dev.domain.com to 192.168.1.4. I have
www.domain.com forwarded to 192.1681.3, it is working perfect. If I type
domain.com, it will bring me to www.domain.com, I can view the site.

What configuration should I use in order to have the dev.domain.com
forwarded to 192.168.1.4?
I've tried this, it does not work:
server {
listen 192.168.1.4:80;
server_name dev.domain.com;
root /var/www/dev;
... more config params here ...
}

server {
listen 192.168.1.3:80;
server_name domain.com;
rewrite ^(.*)$ $scheme://www.domain.com$1 permanent;
}

server {
listen 192.168.1.3:80;
server_name www.domain.com;
root /var/www/html;
... more config params here ...
}

I did a test. I installed nginx on 192.168.1.4 also and ran it directly:
http://192.168.1.4/ everything was OK.

I don't mind running nginx on both servers. All I want is to have
dev.domain.com available to a small group of people. The 192.168.1.4
server is the place where all configuration tests and other programming
tasks are getting completed, so it does not affect the live server
performance nor it interacts in any way with it, beside the subdomain
name.

Thanks a lot for you help.

Floren
Subject Author Posted

Subdomain redirect help

Floren Munteanu May 09, 2009 01:10AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

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