LinuxQuestions.org
Visit Jeremy's Blog.
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 01-06-2010, 11:21 AM   #1
volga629
Member
 
Registered: Dec 2009
Posts: 67

Rep: Reputation: 21
Lightbulb Apache Vhost with reverse proxy and redirection


Here my setup of Apache
I have two virtual hosts on separate IP and on both I am using port :80 one is main website domain.name and another webmail.domain.name.
And to get full link path i am using index.html with redirection derectives. My question how I can setup each Vhost to he is own redirection derictive to set two full link like:
when type webmail.domainname -----> redirect to webmail.domainname/horde/imp/file.php
and www.domainname ------> redirect to www.domainname/csr/
Right now working only one of this Vhosts, just problem to separate them when I type www.domainname -----> apache redirect to webmail.domainname.

########################
index.html

<html>
<head>
<title>WebSite</title>
<meta http-equiv="REFRESH" content="1;url=http://www.domainname/csr/"></HEAD>
<BODY>REDIRECTION</BODY>
</HTML>
################################################
index.html

<html>
<head>
<title>WebSite</title>
<meta http-equiv="REFRESH" content="1;url=http://www.mail.domainname/horde/"></HEAD>
<BODY>REDIRECTION</BODY>
</HTML>

################################################
Listen xxx.xxx.xxx.xxx:80

Alias /horde /dire/ctory/horde/horde

<VirtualHost *:*>
DocumentRoot /dire/ctory/horde
ServerName webmail.domainname
ServerAlias webmail
ProxyPreserveHost On
ProxyRequests Off
ProxyPass horde/ http://webmail.domainname/horde
ProxyPassReverse horde/ http://webmail.domainname/horde
#AccessFileName .htaccess


#Redirect permanent / http://www.webmail.domainname/horde/
#RewriteEngine on
#RewriteRule horde/ http://www.webmail.domainname/horde [R]
#RewriteCond %{HTTP_HOST} ^www.webmail.domainname$
#RewriteRule ^(.*)$ http://www.webmail.domainname/horde$1 [R=301,L]
</VirtualHost>

#############################################
Listen xxx.xxx.xxx.xxx:80

#Alias /csr /dire/ctory/mainweb/csr

#<VirtualHost www.domainname>
# DocumentRoot /dire/ctory/mainweb/csr
# ServerName domainname
# ServerAlias www.sdomainname
#ProxyPreserveHost On
# ProxyRequests Off
# ProxyPass /csr/ http://domainname/csr
# ProxyPassReverse /csr/ http://domainname/csr
#Redirect permanent /csr http://www.domainname/csr
#AccessFileName .htaccess
</VirtualHost>
#############################################

Any help welcome.
Thank you ahead.
 
Old 01-11-2010, 11:15 PM   #2
Elemecca
Member
 
Registered: Nov 2008
Location: San Francisco, CA
Distribution: Gentoo, CentOS
Posts: 71

Rep: Reputation: 22
EDIT: See my next post.

Also, when you put files in a post you should put them in code blocks like "[code]file contents...[/code]". That way they'll end up in a separate monospaced block like this:
Code:
file contents...

Last edited by Elemecca; 01-11-2010 at 11:49 PM. Reason: Looked more closely at first post and saw I was wrong
 
Old 01-11-2010, 11:43 PM   #3
Elemecca
Member
 
Registered: Nov 2008
Location: San Francisco, CA
Distribution: Gentoo, CentOS
Posts: 71

Rep: Reputation: 22
My understanding of your situation is thus: You have a server with two IPs. You would like to use IP-based virtual hosting to host two sites -- a Horde webmail and your main site. You would like 'webmail.example.com' to be the Horde and 'www.example.com' to be your main site. You want each to appear at the root of its respective URL. You do not want to access Horde as 'www.example.com/horde' or your main site as 'webmail.example.com/csr'. Horde and your main site are installed in subdirectories of the same directory, for instance '/var/www/horde' and '/var/www/csr'. Is this correct?

If my above assumptions are correct, the Apache configuration below should do what you want. Replace 'example.com' with your domain name, '/var/www' with the directory containing your sites, 'xxx.xxx.xxx.xxx' with the IP you want to serve Horde from, and 'yyy.yyy.yyy.yyy' with the IP you want to serve your main site from.
Code:
Listen xxx.xxx.xxx.xxx:80
Listen yyy.yyy.yyy.yyy:80

<VirtualHost xxx.xxx.xxx.xxx:80>
    ServerName webmail.example.com

    DocumentRoot /var/www/horde
</VirtualHost>

<VirtualHost yyy.yyy.yyy.yyy:80>
    ServerName example.com
    ServerAlias www.example.com

    DocumentRoot /var/www/csr
</VirtualHost>
There is no need for any redirection, proxying, or URL rewriting.
 
Old 01-13-2010, 03:30 AM   #4
volga629
Member
 
Registered: Dec 2009
Posts: 67

Original Poster
Rep: Reputation: 21
Thank you on replay, you all most right, but situation more complicated.
I implemented two think for first virtual host is just redirection with index.html from port 80 to port 80 external and for this i used revers proxy. And second one is was implemented local on port 80 with reverse proxy on port 80 and permanent redirection to 443. And 443 just reverse proxy from 443 to 443 with index.html redirection to link path with i need to make no hassle to clients.
You can visit www.skillsearch.ca and www.webmail.skillsearch.ca and you can see the all redirection yourself and how look all links.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 as Reverse Proxy LR_Brian Linux - Server 4 02-17-2009 11:33 AM
Apache reverse proxy noir911 Linux - Server 0 02-05-2008 08:21 PM
reverse proxy with apache 2 bootiack Linux - Software 1 08-09-2005 06:47 PM
apache reverse proxy wildbob Linux - Networking 8 10-15-2003 12:16 PM
apache Reverse Proxy !!!!! ashish_v Linux - Software 0 09-05-2003 04:42 PM


All times are GMT -5. The time now is 09:49 PM.

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration