XAMPP + RAILS

Irgendwelche Probleme mit XAMPP für Linux? Dann ist hier genau der richtige Ort um nachzufragen.

XAMPP + RAILS

Postby sabkaraja » 03. July 2009 11:24

Hi
I am hosting a web server which running Rails. Currently, I am running mongrel (rails webserver) on port 80 and pushed xampp to a non-standard 3000 port.

I would like php and rails coexist on the same port. I tried adding virtualhost, but it wasnt successful. How should I go about it. I have installed Phusion passenger module for running rails app in apache.

In my ideal world, xampp should be on some other port (or subdomain), where as php and rails on the 80 port.

I am aware that rails is out of scope of the discussion. If anyone knows how to make them work together it would be great.

thanks
R
sabkaraja
 
Posts: 1
Joined: 03. July 2009 11:11

Re: XAMPP + RAILS

Postby Nobbie » 03. July 2009 15:11

sabkaraja wrote:In my ideal world, xampp should be on some other port (or subdomain), where as php and rails on the 80 port.


But that is impossible, you have a wrong understanding of the software architecture of xampp:

a) xampp is nothing, only an abbreveation for a software collection
b) php is an interpreter running in a webserver
c) xampp delivers Apache and PHP, where Apache is the webserver
d) Apache is running on certain ports and triggers PHP scripts. PHP is *not* running on certain ports.

Therefore, you cannot run "xampp" (you obviously mean Apache) on some port, and php on another port. PHP runs beyond Apache.

If you succeed to run rails without mongrel, instead under Apache, there will be no problem to run all the tools together on the same port 80 (which is the default port for HTTP Protocoll).

If you need mongrel for rails and want to run PHP on Port 80, you must

a) run mongrel on a different port than 80 (for example 8080, or just viceverse as you did, run mongrel under port 3000).
b) create a virtualhost in apache (for example rails.mydomain.com)
c) configure a Reverse Proxy for that Virtualhost, which eveluates all requests on the mongrel server. This may look similar to that:

Code: Select all
<VirtualHost ...>
ServerName rails.mydomain.com
...
ProxyPass / http://localhost:3000/
ProxyPassReverse / http://localhost:3000/
...
</VirtualHost>


In that environment, Apache is acting like a proxy for the request to rails.

Instead of creating a VirtulHost, you also may create a ReverseProxy for a certain folder, for example ./rails. Then simply create the proxy for your standard domain, only for /rails folder:

Code: Select all
ProxyPass /rails/ http://localhost:3000/
ProxyPassReverse /rails/ http://localhost:3000/


The rails server will then be accessed via http://www.youdomain.com/rails/
Nobbie
 
Posts: 13183
Joined: 09. March 2008 13:04


Return to XAMPP für Linux

Who is online

Users browsing this forum: No registered users and 9 guests

cron