skip to Main Content

I am currently working on a website where the core of the website is in PHP. I now want to write a bunch of applications on top of that core, and was hoping to do it in Rails. I saw a couple things online where you could set single folders to be handled by PHP, (example: http://macdiggs.com/2007/06/29/using-php-inside-rails-structure-on-apache/) but I am hoping to do the opposite, have single folders that are handled by Rails, and then the rest is handled by PHP. For example, having ourwebsite.com/blog as a Rails app, but ourwebsite.com and ourwebsite.com/internal are all in PHP. What kind of Apache configurations would let this happen?

(As a bonus, my server is managed by Plesk, so I am concerned about making straight changes to the apache configuration. I have root access, so I can do it, but I am worried that Plesk might get mad)

EDIT: I should also mention, I am using Subdomains as part of my application, so I would really prefer to have something like ourwebsite.com/rails_app. If that is the only option, I can go that route, but I would prefer not to.

2

Answers


  1. I am working on a project and its having some blog in php ie wordpress and application in rails. Just configured it an hour before. Might help you.

    <VirtualHost *:80>
    ServerName abc.com
    DocumentRoot /home/me/apps/my_rails_app/current/public
    </VirtualHost>
    
    <VirtualHost *:80>
    ServerName blog.abc.com
    DocumentRoot /home/me/apps/abc/wordpress
     <Directory "/home/me/apps/abc/wordpress">
            Options +Indexes FollowSymLinks
            AllowOverride All
            Allow from all
            Order allow,deny
        </Directory>
    
    </VirtualHost>
    
    Login or Signup to reply.
  2. If you want the PHP app to be default application and only use Rails for a subdirectory, this Apache configuration should work for you:

    DocumentRoot "/path/to/your/php/app/html"
    ProxyPass /some_resource http://127.0.0.1:3000/some_resource
    

    Note that your rails application would be running on port 3000 and you will need the ProxyPass Apache module installed.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search