LinuxQuestions.org
Help answer threads with 0 replies.
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-23-2011, 04:30 PM   #1
id_viorel
LQ Newbie
 
Registered: Jul 2004
Location: Focsani
Posts: 29

Rep: Reputation: 15
Virtual host


Hello,

I have a cisco router and 2 web servers inside my local network: web1 - 192.168.1.11 and web2 - 192.168.1.22 and I want both servers to be accesseble from Internet on 443.
Now, I have on the router a redirection of all incoming packets with dest port 443 to web1. I cannot figure out how can I do the second redirection to web2.
I want this:
https://web1.mydomain.com to access web1
and
https://web2.mydomain.com to access web2

or

https://www.mydomain.com/web1 to access web1
and
https://www.mydomain.com/web2 to access web2

Can this be done with virtual host ?

10x
viorel
 
Old 02-24-2011, 02:01 AM   #2
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985
You can't do this on ios, no.you'd want some sort of reverse proxy like nginx or apache infront of the backend servers to do this.
 
Old 02-24-2011, 02:38 AM   #3
tkmsr
Member
 
Registered: Oct 2006
Distribution: Ubuntu,Open Suse,Debian,Mac OS X
Posts: 798

Rep: Reputation: 39
Hi id_viorel
what you asked is 100% possible with an Apache Reverse Proxy configuration for which is done in the virtual host definition.
On the gateway machine you need to create 2 virtual hosts ( I use Ubuntu for gateway) in

Quote:
/etc/apache2/sites-enabled/web1.conf
/etc/apache2/sites-enabled/web2.conf
the virtual hosts will be as follows for web1 (I have omitted the log part you can do it)

Quote:
<VirtualHost *:80>
ServerName web1.mydomain.com

ProxyPass / http://(internal IP of web1)/
ProxyPassReverse / http://(internal IP of web1)/
</VirtualHost>
and same for web2

Quote:
<VirtualHost *:80>
ServerName web2.mydomain.com

ProxyPass / http://(internal IP of web2)/
ProxyPassReverse / http://(internal IP of web2)/
</VirtualHost>
How ever there is one word of caution.For situations like this you will need to create one more vhost since Apache on Ubuntu reads the vhost definitions in alphabetical order of virthal host file names (yes thats right file names) so create a third virtual host which takes care of unwanted redirections.
Once you understand how to use Reverse Proxy then read
http://mightydreams.blogspot.com/201...host-best.html

Last edited by tkmsr; 02-24-2011 at 02:47 AM.
 
  


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
debian lenny - all virtual hosts lead to first virtual host rantastic Linux - Server 2 04-21-2010 09:32 PM
Is there anyway for one Virtual Server to access the main host, or another Virtual Se abefroman Linux - Security 5 01-08-2010 08:06 PM
[SOLVED] Apache2 - virtual host defaulting to default host slimjim Linux - Server 1 10-31-2009 01:47 AM
Adding virtual interface for IP based virtual host pridefc Linux - General 6 03-16-2008 03:52 PM
virtual users and virtual host need to stay at /home nephish Linux - Networking 3 01-14-2006 01:36 PM

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

All times are GMT -5. The time now is 03:18 PM.

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