Forum: Ruby on Rails Get rid of the "public"

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Lunohod L. (Guest)
on 2006-03-07 13:37
Hello to all!

First I want to appologize if this topic has been already discussed but
the search does not work :)

I have RoR installed on a shared server. I also have a RoR application
installed in a subdomain. The structure is as follows:

www  //this is my home WWW folder
  +--- www  //maps to www.mydomain.com
  |
  +--- webapp  //maps to webapp.mydomain.com. Here is my RoR application
  |      +--- app
  |      +--- components
  |      +--- config
  |      +--- db
  |      +--- lib
  |      +--- log
  |      +--- public
  |      +--- script
  |      +--- themes
  |      +--- vendor
  |
  +--- anothersubdomain  // maps to anothersubdomain.mydomain.com


As shown above my RoR application is installed in the webapp folder. I
do not have other RoR applications installed.

Is there a way to get rid of the "/public" in my url's? I read all the
tutorials at http://wiki.rubyonrails.com/rails/pages/Howtos but I just
can not manage to make it. I am going to hang myself on the next tree...
I just need a concrete example. Can someone help me?

Thank you in advance!

Regards
Lugovoi N. (Guest)
on 2006-03-07 13:52
(Received via mailing list)
Hm, that setup seems to open big security breach:
is http://webapp.mydomain.com/config/database.yml visible?

Advise: don't place your code under website document root.

It should be possible to place there only contents of your  "public"
dir, and the rest of your app - somewhere outside webroot, e.g.
/home/you/rails-app, with symlink  /home/you/rails-app/public ->
www/webapp.mydomain.com/
Lunohod L. (Guest)
on 2006-03-07 15:52
Lugovoi N. wrote:
> Hm, that setup seems to open big security breach:
> is http://webapp.mydomain.com/config/database.yml visible?
>
> Advise: don't place your code under website document root.
>
> It should be possible to place there only contents of your  "public"
> dir, and the rest of your app - somewhere outside webroot, e.g.
> /home/you/rails-app, with symlink  /home/you/rails-app/public ->
> www/webapp.mydomain.com/

Thank you for the advise! I have used .htaccess files to secure the
sensible data. Unfortunatelly it is not possible to use symlinks... Is
there another way ot solving my problem?


Regards
Joshua W. (Guest)
on 2006-03-07 16:28
(Received via mailing list)
Can you configre your DNS so that webapp.mydomain points to
/home/you/rails-app/public ?
Marcus B. (Guest)
on 2006-03-07 16:53
(Received via mailing list)
Lunohod Lunohodov wrote:

> Thank you for the advise! I have used .htaccess files to secure the
> sensible data. Unfortunatelly it is not possible to use symlinks... Is
> there another way ot solving my problem?

Try mapping directly to your "public" directory, i.e:

webapp.mydomoin.com -> /your/rails/app/public

-- Marcus
This topic is locked and can not be replied to.