6

I have a Ubuntu box 10.04 that already has a LAMP stack configured on it.

I would like to play around with Rails on this machine as well. Is there a way I can install Rails without messing up the PHP stuff? Maybe have it default to the PHP server and switch to the Rails server when I use a certain port?

4 Answers 4

3

You're misunderstanding how rails and php work.

When you run rails server in the rails project, it runs it on port 3000 by default (for development).

LAMP traditionally runs on port 80, so you can run both rails and LAMP at the same time.

For instructions on properly install rails on Ubuntu, take a look at this answer.

0

For production environment you should consider using Apache to serve your Rails projects.

The easy way is using Apache mod-fcgid and run rail projects via fcgid.

http://gabrito.com/post/running-ruby-on-rails-with-apache-2-and-mod_fcgid

For better performance, mod-passenger is usually preferred. But it might be harder to setup for beginners as Ubuntu install apache2-mpm-prefork + mod-php5 by default. mod-messenger depends on apache2-mpm-worker, but mod-php5 is incompatible with apache2-mpm-worker.

I use mod-passenger with apache2-mpm-worker and run php script using mod-fcgid.

https://help.ubuntu.com/community/RubyOnRails#Configure_Apache

0

Yes! as long as you run them in different ports... for example localhost:3000 for Rails and 8888 for PHP will work fine!

0

On an older virtual cloud server I had about 10 small web apps and used both Nginx for my Rails web apps and Apache for my PHP apps on a single server (also note with Phusion Passenger for the rails apps). Nginx was set as the primary server. In the virtual hosts section of the nginx configuration file, if the requested URL was for a PHP app, then nginx would serve as a reverse proxy and hand the request off to the Apache server. This works well because from the outside it appears all apps are running through the same port 80. I don't have a link to the original setup article I followed, but here are a few similar.

http://kbeezie.com/apache-with-nginx/

https://www.digitalocean.com/community/tutorials/how-to-configure-nginx-as-a-reverse-proxy-for-apache

FYI, on a new server that I am currently setting up, I plan to run both my rails and PHP apps through the nginx server.

You must log in to answer this question.

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