2

I'm hosting two applications on my web server, one is a Drupal site, and the other is an Errbit installation, which is a Ruby on Rails application. The URLs looks something like this:

http://ourcompany.com
http://errbit.ourcompany.com:3000

I want to drop the need for :3000 on the second URL, so we can access it directly via:

http://errbit.ourcompany.com

I don't want to redirect, I want the URL to remain, without the port number. I've previously used the following command line commands to set some IP table reconfiguration:

sudo iptables -t nat -I PREROUTING -p tcp --dport 80 -j REDIRECT --to-ports 3000 
sudo iptables -t nat -I OUTPUT -p tcp -d 127.0.0.1 --dport 80 -j REDIRECT --to-ports 3000

...which worked fine, as there was no Apache running on the old server. However, this will cause ALL requests on port 80 to be redirected to port 3000, meaning it will break access to http://ourcompany.com

How do I set this up?

Is there a way to configure the IP tables to allow this, or would this be done in the Apache2 configuration?

6
<VirtualHost *:80>
ServerName errbit.ourcompany.com
ProxyPreserveHost On
ProxyPass / http://localhost:3000/
ProxyPassReverse / http://localhost:3000/
</VirtualHost> 

http://httpd.apache.org/docs/2.0/mod/mod_proxy.html

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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