Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I've followed instructions on running two web apps in apache and my current confs are like this:

I have a php web app on port 80 and a rails app on port 88. The php app works fine but the rails app won't load (timeout) if i try to go to If I switch it and make the rails app 80 and the php app 88, the rails app works but php won't load. It's obviously not a rails or php problem. I added port 80 and 88 to the iptables but it still won't work. Any insight or help would be greatly appreciated. If you want to see outputs of certain commands, just let me know.

--edit: I also disabled iptables and ufw but still got a timeout.. I'm so confused. --edit2: It turns out I couldn't use those ports for something. It's working great on port 8000. Thanks for all the help, sorry about this..

share|improve this question
Can you provide your iptables rules? – Epaphus Jan 19 '13 at 0:53 – scssquatch Jan 19 '13 at 1:13
up vote 1 down vote accepted

Looking at the IPtables rules you need to allow traffic to port 88.

iptables -A INPUT-p tcp --dport 88 -j ACCEPT

This should open port 88 so you can connect to the program running on it.

You might want to take a look at installing Phusion Passenger on your Apache server, this will allow you run your PHP and Rails app on the same port and it is very easy to install

share|improve this answer
Ooh I have passenger but I didn't know you could deploy php stuff with it. Ill look into that, thanks. – scssquatch Jan 20 '13 at 21:28
I gave you the right answer because the problem was some weird port issues. The connection wouldn't let me in on 88, 90, 81, 8080, or a bunch of others, but 8000 works great.. Keep that in mind if anyone else has this issue. Try other ports! haha. – scssquatch Jan 20 '13 at 22:33
Well, Apache will still need the PHP handler installed for PHP to work but both will work together so you have Ruby and PHP code on the same Apache server – Epaphus Jan 20 '13 at 22:48

Some years ago I have to do this in my work, I use mod_rewrite and my problems were solved.

Please see:

You can make something like:

<VirtualHost *:80>

    ProxyRequests Off
    ProxyPreserveHost On

    <Proxy *>
        Order allow,deny
        Allow from all

    ProxyPass /
    ProxyPassReverse /

    RewriteEngine On
    RewriteRule ^/ /SPL/ [L,P,R]

Then make another, and when the connections goes to your 80 or 443 they found the right server. ;-) Hope it helps!

share|improve this answer
I'm not sure how I would use this to do what I need? Would I have it look for like /example then have it redirect to my /var/www/ app? then loook for /example_2 and redirect to /home/bakis/vdc/? – scssquatch Jan 19 '13 at 1:25
Hi! You need to put an apache in the front and your server applications with another port. The VirtualHost entry two times in your config file, which the first is the hostname1 and the second the hostname2, put these two entries with '<VirtualHost *:80>' so they'll found when some user try to connect in port 80. Then the 'RewriteEngine' will do the magic, just put the servers that u want with the addr:port, something like: for host1 and for host2 and put these on 'ProxyPass' tags. Hope it helps :) Sorry for my english! :] – Alexandre Mulatinho Jan 21 '13 at 1:02

What happens if you put

NameVirtualHost *:88

NameVirtualHost *:80

Instead of

NameVirtualHost *:80

NameVirtualHost *:88


share|improve this answer
Nothing happened. I still get a timeout when trying to hping it or access it in a browser. – scssquatch Jan 20 '13 at 1:44

Your Answer


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.