Skip to content

Rubyonrails contains php application in its subdirectory

October 12, 2011

There are many great web software built in PHP . At some point we need to integrate  one of them with our Rubyonrails app.

This tutorial will guide you how to do this. As an example I will use WordPress since it is one of the most popular one. This can also be applied to any Php application.

Create project

  • Create an Rails project called “” in /var/www
  • Create a directory /var/www/


this will allow you to access wordpress by . Change to whatever you want your url. I will keep highlighting the word blog so you can keep it consistent.


Go to download and extract the files to /var/www/ blog . This directory is the root of your wordpress.

Create virtual host

Let start configuring virtual host. In your terminal   sudo nano /etc/hosts and add the following

save it. I used my local ip 127.0.01. You can replace it to your web server ip. make sure the file is saved.

Configure your web server

Create a file /etc/apache2/sites-available/

<VirtualHost *:80>
DocumentRoot /var/www/
<Directory /var/www/>
AllowOverride all
Options -MultiViews

<Location /blog>
PassengerEnabled off



We need to tell apache to enable this virtualhost with the following command:    sudo a2ensite

and then reload apache with the following commant: sudo /etc/init.d/apache2 reload


Fire it by typing this: in your web browser


Done !!!

One Comment
  1. Stanford Guillory permalink

    Worked like a charm. Thanks!

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: