Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8655811
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T15:07:48+00:00 2026-06-12T15:07:48+00:00

I would like to run a rails app under a subdirectory on my Linux

  • 0

I would like to run a rails app under a subdirectory on my Linux VPS, and having trawled the passenger documentation I am unsure as to how to set up the proper virtualhost config and symlinks for my machine.

I have a domain called http://www.domain.eu and a rails app located at /apps/webapp, and i would like the site to be hosted at http://www.domain.eu/webapp

Im am unsure of a few areas:

1.) Where should i enter the webapp VirtualHost config details? should it be in the apache2.conf file or should create a file in sites-available called webapp and put the config in there? There seems to be many conflicting examples.

2.) Learning from the previous question, how could I amend this apache2.conf file to serve up the rails app under the directory www.domain.eu/webapp (again read through lots of docs, but there seems to be many ways of doing this)

<VirtualHost *:80>
      ServerName domain.eu
      # !!! Be sure to point DocumentRoot to 'public'!
      DocumentRoot /apps/webapp/public
      <Directory /apps/webapp/public>
         # This relaxes Apache security settings.
         AllowOverride all
         # MultiViews must be turned off.
         Options -MultiViews
      </Directory>

      RailsBaseURI /webapp
      <Directory /apps/webapp/public>
        Options -MultiViews
      </Directory>
   </VirtualHost>

3.) I realise that a symlink needs to be created to point the directory root to the url. Having tried ln -s /apps/webapp/public ./test it comes back with a missing symlink error. What would be recommended here?

4.) Lastly, rails 3 config.action_controller.relative_url_root = "/webapp" appears to be deprecated, is there a new recommended convention to use?

my setup: Linux VPS server running Ubuntu 10.04, mysql 5, apache2, phusion passenger (latest), ruby 1.9.3 and rails 3.2.3.

If anyone needs more code just shout, thanks in advance!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T15:07:49+00:00Added an answer on June 12, 2026 at 3:07 pm

    So after much reading I managed to get this working.

    For my purpose I added in the VirtualHost info for a sub URI site into the bottom my apache2.conf file, it may be httpd.conf for you, but you can enter these into /etc/apache2/sites-available if you wish to keep it all seperate.

    At the top of this file I specify where the default “homepage” for the server is. I am running apache2 so my homepage is located at /var/www. Below this we set our rails Sub URI options, so firstly specify what URL you would like as your sub URI, then point the directory tag to the public folder of your rails app. MultiViews must be off hence the (-) so our apache2.conf file is complete.

    <VirtualHost *:80>
            ServerName domain.com
            DocumentRoot /var/www
            <Directory /var/www>
            Allow from all
            </Directory>
    
    
            RailsBaseURI /webapp
            <Directory /apps/webapp/public>
            Options -MultiViews
            </Directory>
    </VirtualHost>
    

    Now all we have to do is create a symlink in our sites-enabled folder to point the /var/www/webapp to our /apps/webapp/public folder, which looks like this.

    ln -s /apps/webapp/public /var/www/webapp
    

    Now was we are creating a symlink, we don’t have to insert any extra code into our rails routes or environment file. You can specify which environment you would like to use using RackENV production (aparently al rails 3 + apps are rack ? please comment if this is not the case)

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I would like to run APIDemos under platforms\android-1.5\samples directory on Android emulator but I
I'm trying to get a bare bones Rails app deployed under Apache, Passenger 3.0.0
I would like to set up multiple Rails apps running simultaneously. I'm using a
I am developing a Rails app. I would like to use an array to
I've got some heavyweight process, which does some video processing. I would like run
I would like to run a jar file extracted from my java project to
I would like to run this script (embed drive list in a site) that
I would like to run a script in production. This script generates a record
I would like to run my node.js application without the automatic logs it prints
I would like to run a script indefinitely. It look likes my current script,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.