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.
0615fbd23aa01a52e5d666ea5e5c7d7b?d=identicon&s=25 Lunohod Lunohodov (lunohodov)
on 2006-03-07 12: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
5c19f2d52879a1e10670c7334ba4c7e3?d=identicon&s=25 Lugovoi Nikolai (Guest)
on 2006-03-07 12: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/
0615fbd23aa01a52e5d666ea5e5c7d7b?d=identicon&s=25 Lunohod Lunohodov (lunohodov)
on 2006-03-07 14:52
Lugovoi Nikolai 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
1135d4703e47b03465798d3f63b3995f?d=identicon&s=25 Joshua Wehner (Guest)
on 2006-03-07 15:28
(Received via mailing list)
Can you configre your DNS so that webapp.mydomain points to
/home/you/rails-app/public ?
Dac440de4823fa56ffc6dc25ba1f8e9c?d=identicon&s=25 Marcus Brito (Guest)
on 2006-03-07 15: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.