Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I'm working with Apache 2.2.11 on Windows (using the WAMP install). The Server's IP is for example 3.3.3.3. My main Apache install (apache1) is listening on port 80 and serves a website (www.domain1.com). We recently installed an application that has a web publishing feature, which internally uses apache (apache2). I have configured that application to listen on port 3000. I want to serve this second application via the domain name (something.domain2.com).

Now I have setup both the DNS entries to point to the same IP. However I was trying to configure the main apache instance (apache1) to redirect any requests for something.domain2.com on port 80 to something.domain2.com:3000 (so that it can be taken over by apache2). The VirtualHost configuration I tried first was

ServerName something.domain2.com Redirect 301 / http://something.domain2.com:3000/

This does not work. Any ideas?

share|improve this question
add comment

2 Answers

up vote 1 down vote accepted

Your setup could/should work, I guess it looks something like this:

NameVirtualHost *:80

<VirtualHost *:80>
    ServerName www.domain1.com
    ServerAdmin admin@domain1.com

    DocumentRoot "/export/htdocs"
    ErrorLog "/var/log/apache_error.log"
    CustomLog "var/log/apache_access.log" common
</VirtualHost>

<VirtualHost *:80>
    ServerName something.domain2.com
    Redirect permanent / http://something.domain2.com:3000/
</VirtualHost>

It probably would be best if you post your apache config and maybe some of the apache logs.

one other thought: Have you tested if you are able to reach http://something.domain2.com:3000/ without the redirect?

share|improve this answer
    
Marcel G, Yup, the apache2 instance is working fine (accessible and viewable) on port 3000. I will try and link my apache.conf. However it is the standard vanilla config, nothing out of the ordinary. –  Archit Baweja Jun 6 '11 at 18:43
    
Marcel G, that seemed to work for me. Only difference I see was the 301 v/s permanent for the first param for Redirect directive. Oh well I may have missed something earlier I guess. Thanks! –  Archit Baweja Jun 6 '11 at 18:48
    
always good to hear that it worked in the end... the 301 vs. permanent should not make a difference but I prefer the later, cause I find it more readable. –  Marcel G Jun 7 '11 at 1:09
add comment

Look into Apache2's mod_proxy: http://httpd.apache.org/docs/2.2/mod/mod_proxy.html

Your vhost might look something like:

ServerName foo.domain2.com

Order allow, deny
Allow from all

ProxyRequests Off

ProxyPass http://localhost:3000/
ProxyPassReverse http://localhost:3000/
share|improve this answer
    
rovangju, thanks I tried the proxy setup however my apache wouldn' start. And I don't know how to check (if there is any) the "start log". –  Archit Baweja Jun 6 '11 at 18:45
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.