Apache Configuration For Rails Apps

October 23, 2008 at 9:00 am Leave a comment

Configuring single rails app on apache server

To host your rails app through apache one need to add the virtual host entry in the httpd.conf

<VirtualHost *>
    # Server name
    ServerName test.example.com

    # Proxy ACL
    <Proxy *>
        Order allow,deny
        Allow from all
    </Proxy>

    # Proxy directives
    ProxyPass / http://localhost:3000/
    ProxyPassReverse / http://localhost:3000/
    ProxyPreserveHost on

    # Logfiles
    ErrorLog  /var/log/apache2/test.example.com.error.log
    CustomLog /var/log/apache2/test.example.com.access.log combined

</VirtualHost>

Configuring multiple rails app on single apache server

<VirtualHost *>
    # Server name
    ServerName test.example.com

    # Proxy ACL
    <Proxy *>
        Order allow,deny
        Allow from all
    </Proxy>
<Directory "/var/www/html/railsApp/public">
Options Indexes FollowSymLinks
AllowOverride none
Order allow,deny
Allow from all
</Directory>

    # Proxy directives
    ProxyPass /railsApp http://localhost:3000/
    ProxyPassReverse /railsApp http://localhost:3000/
    ProxyPreserveHost on

    # Logfiles
    ErrorLog  /var/log/apache2/test.example.com.error.log
    CustomLog /var/log/apache2/test.example.com.access.log combined

</VirtualHost>

you can access theis application as :
http://test.example.com/railsApp

For this we have to make a small adjustmwnt in our code and and add the folloeing code in pur apps enviornmrnt.rb
ActionController::AbstractRequest.relative_url_root = "/railsApp"

Entry filed under: Uncategorized. Tags: .

Ferret server Ruby On rails Installation for developers

Leave a Reply

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

WordPress.com Logo

You are commenting using your WordPress.com 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 )

Google+ photo

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

Connecting to %s

Trackback this post  |  Subscribe to the comments via RSS Feed


Calendar

October 2008
M T W T F S S
« Sep   Aug »
 12345
6789101112
13141516171819
20212223242526
2728293031  

Most Recent Posts


%d bloggers like this: