LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 02-10-2009, 11:57 AM   #1
tuty_richard
LQ Newbie
 
Registered: Feb 2009
Posts: 1

Rep: Reputation: 0
Apache : Forward request to another server


I have static IP set to my router. I am running two web servers. I have redirected my 80 port from the router to my server 1 its working fine. I need a help in setting up like this

I have domain say mydomain.com when ever I type mydomain.com in my browser it comes to my router then to my server 1 thats fine.

I have sub domain say sub.mydomain.com when ever I type sub.mydomain.com the router redirects to my webserver1. but what I need is my sub.mydomain has to be served by my server 2.

<VirtualHost *:80>
ServerName sub.mydomain
ServerAlias www.sub.mydomain
RewriteEngine On
RewriteRule ^(.*)$ http://192.168.0.101$1 [P]
</VirtualHost>

By adding this setup when ever I type sub.mydomain it redirects to my server 2 that is fine. But when my url changes to like sub.mydomain.com/mail the browser shows like http://192.168.0.101:80/mail. How to over come this problem please help me.

Thanks
Richard
 
Old 02-14-2009, 08:38 AM   #2
routers
Member
 
Registered: Aug 2005
Location: Malaysia - KULMY / CNXTH
Distribution: Slackware, Fedora, FreeBSD, Sun O/S 5.10, CentOS
Posts: 787
Blog Entries: 6

Rep: Reputation: 75
richard. try this way

#important to edit local ip in /etc/hosts for lan ip 192.168.0.101
# 192.168.0.101 sub.mydomain <- /etc/hosts for both server1 and server2
<VirtualHost *:80>
ServerName sub.mydomain
RewriteEngine On
RewriteRule ^(.*)$ http://sub.mydomain/$1 [P]
UseCanonicalName On
RewriteRule ^(.*)$ [L]
</VirtualHost>


give a try
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Apache: Forward request to another box? MasterC Linux - Networking 11 12-23-2014 09:37 PM
HTTP REQUEST to Apache server from C program Balakrishnan84 Programming 6 07-26-2007 04:00 AM
How2 let apache2 forward the request to another web-server on another machine boomy Linux - Software 9 12-04-2005 03:50 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 04:39 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration