Get rid of the "public"

Hello to all!

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

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 Peak Obsession 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

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/

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

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

Can you configre your DNS so that webapp.mydomain points to
/home/you/rails-app/public ?