PHP app on the same server as Rails app

Hi,

I am trying to figure out how to best serve a PHP app on the same server
as my Rails app. Basically, the PHP app is a 3rd party blog that I want
to be able to access on the same server. The server is powered by
mongrel cluster and apache. I tried putting the blog in /public but then
/blog/login does not work, while /blog/login.php does. Anyway what is
the best way to solve this?

On Mon, Sep 28, 2009 at 6:13 PM, Greg L.
[email protected] wrote:

I am trying to figure out how to best serve a PHP app on the same server
as my Rails app. Basically, the PHP app is a 3rd party blog that I want
to be able to access on the same server. The server is powered by
mongrel cluster and apache. I tried putting the blog in /public but then
/blog/login does not work, while /blog/login.php does. Anyway what is
the best way to solve this?

I’d set each app up on it’s own subdomain. But if you can’t you can
use mod_rewrite to sort out where requests should go.

http://httpd.apache.org/docs/2.2/mod/mod_rewrite.html


Greg D.
http://destiney.com/

Greg D. wrote:

On Mon, Sep 28, 2009 at 6:13 PM, Greg L.
[email protected] wrote:

I am trying to figure out how to best serve a PHP app on the same server
as my Rails app. Basically, the PHP app is a 3rd party blog that I want
to be able to access on the same server. The server is powered by
mongrel cluster and apache. I tried putting the blog in /public but then
/blog/login does not work, while /blog/login.php does. Anyway what is
the best way to solve this?

I’d set each app up on it’s own subdomain. But if you can’t you can
use mod_rewrite to sort out where requests should go.

mod_rewrite - Apache HTTP Server Version 2.2


Greg D.
http://destiney.com/

I agree that subdomain would be great. However when I set up
blog.mysite.com all of the links still point to mysite.com/blog instead
of blog.mysite.com/blog. Is it because I set up the subdomain wrong or
is it because mongrel is doing something here?

I would assume that you are using passenger…

Just setup the rails app like normal then create a locations element
for the blog and turn off rails for this directory

And here is the cut’n paste from the Passenger documentation

<VirtualHost *:80>
ServerName www.foo.com
DocumentRoot /apps/foo/public
<Directory /apps/foo/public/wordpress>
PassengerEnabled off
AllowOverride all # ← Makes Wordpress’s .htaccess file
work.

Greg L. wrote:

Hi,

I am trying to figure out how to best serve a PHP app on the same server
as my Rails app. Basically, the PHP app is a 3rd party blog that I want
to be able to access on the same server. The server is powered by
mongrel cluster and apache. I tried putting the blog in /public but then
/blog/login does not work, while /blog/login.php does. Anyway what is
the best way to solve this?

I personally just use a different sub-domain.

Cheers,
Mohit.
9/29/2009 | 9:02 AM.

I agree that subdomain would be great. However when I set up
blog.mysite.com all of the links still point to mysite.com/blog instead
of blog.mysite.com/blog. Is it because I set up the subdomain wrong or
is it because mongrel is doing something here?

If you are using WP (but I think is the same for most blogging platform)
you need to reinstall the blog engine , you cannot just move from one
address to another

In WP there is a way to change the base blog_url but is easier and safer
to just export , reinstall and import.

http://kb.mediatemple.net/questions/279/Ruby+on+Rails+using+Mongrel+Clusters

It looks like there’s a part about setting up your vhost.conf. Did you
go through these steps? If so, I’d guess that it’s the place you want
to make your edits to exclude blog URL from being redirected.

On Sep 28, 8:37 pm, Greg L. [email protected]

heimdull wrote:

I would assume that you are using passenger…

Just setup the rails app like normal then create a locations element
for the blog and turn off rails for this directory

And here is the cut’n paste from the Passenger documentation

<VirtualHost *:80>
ServerName www.foo.com
DocumentRoot /apps/foo/public
<Directory /apps/foo/public/wordpress>
PassengerEnabled off
AllowOverride all # ← Makes Wordpress’s .htaccess file
work.

I’m using mongrel cluster behind Apache. It is a WP blog. I’m on
MediaTemple host and the way they set it up there is no DocumentRoot
specified in httpd.conf. Is there anyway to tell Apache not to send the
request to mongrel (like PassengerEnabled)?

Thanks to everyone for the help.

Indeed my problem was that I needed to re-install the WP blog like
Simone suggested. Now my subdomain works as expected.