0

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?

2 Answers 2

1

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

NameVirtualHost *:80

<VirtualHost *:80>
    ServerName www.domain1.com
    ServerAdmin [email protected]

    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?

3
  • 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. Jun 6, 2011 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! Jun 6, 2011 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, 2011 at 1:09
0

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/
1
  • 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". Jun 6, 2011 at 18:45

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .