# Deploying an application to the web

**URL:** <https://www.ruby-forum.com/t/deploying-an-application-to-the-web/82236>\
**Category:** Rails\
**Created:** [January 18, 2007, 1:12pm UTC](https://www.ruby-forum.com/t/deploying-an-application-to-the-web/82236 "2007-01-18T13:12:47Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![cdvr](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/b38774/32.png) [@cdvr](https://www.ruby-forum.com/u/cdvr)\
**Post date:** [January 18, 2007, 1:12pm UTC](https://www.ruby-forum.com/t/deploying-an-application-to-the-web/82236/1 "2007-01-18T13:12:47Z")

</div>

Ok, so I got my web host to install Ruby and RoR for me!

The posted a “testapp” just so that I could see its up and working. So  
they created a directory named “testapp” which is in my “public\_html”  
folder (so it can be seen by the world). Anyways, inside “testapp” is  
all the standard RoR folders (app, config, db, etc, etc). So basically  
to access their sample app the url is…

www.\<url\_here\>.com/testapp/app/say/hello

How can I get the url to only be, www.\<url\_here\>.com/say/hello or just  
/hello ?

Thanks.

---

<div class="post-metadata">

**Author:** ![cdvr](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/b38774/32.png) [@cdvr](https://www.ruby-forum.com/u/cdvr)\
**Post date:** [January 18, 2007, 1:21pm UTC](https://www.ruby-forum.com/t/deploying-an-application-to-the-web/82236/2 "2007-01-18T13:21:48Z")

</div>

Actually, your url with your current setup would be  
[url.com/public/controller/method](http://url.com/public/controller/method). The rewriting is done through  
.htaccess and dispatching, not accessing the app folder directly. Also,  
with that setup, everyone could go [url.com/config/datbase.yml](http://url.com/config/datbase.yml) and get  
your DB credentials.

I expect that you are on a unix box.

You want the testapp dir to be in the same dir as public\_html. In other  
words, say public\_html is in /home/your\_user/public\_html, the app  
should be in /home/your\_user/testapp.

Then you create a symlink. Remove the entire public\_html folder. Then,  
in /home/your\_user do this command:

ln -s testapp/public public\_html

There you go, [url.com](http://url.com) will now be directly to your RoR app.

---

<div class="post-metadata">

**Author:** ![cdvr](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/b38774/32.png) [@cdvr](https://www.ruby-forum.com/u/cdvr)\
**Post date:** [January 18, 2007, 1:37pm UTC](https://www.ruby-forum.com/t/deploying-an-application-to-the-web/82236/3 "2007-01-18T13:37:13Z")

</div>

shouldn’t this be done via a load balancer?

removed\_email\_address@domain.invalid wrote:

> Actually, your url with your current setup would be  
> [url.com/public/controller/method](http://url.com/public/controller/method). The rewriting is done through  
> .htaccess and dispatching, not accessing the app folder directly. Also,  
> with that setup, everyone could go [url.com/config/datbase.yml](http://url.com/config/datbase.yml) and get  
> your DB credentials.
> 
> I expect that you are on a unix box.
> 
> ln -s testapp/public public\_html
> 
> There you go, [url.com](http://url.com) will now be directly to your RoR app.

---

<div class="post-metadata">

**Author:** ![cdvr](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/b38774/32.png) [@cdvr](https://www.ruby-forum.com/u/cdvr)\
**Post date:** [January 18, 2007, 4:28pm UTC](https://www.ruby-forum.com/t/deploying-an-application-to-the-web/82236/4 "2007-01-18T16:28:03Z")

</div>

ok what I normally do is put my php scripts, html pages etc into  
user/public\_html/

i guess i am trying to figure out where to put my rails app which has  
directories like…

my\_app/  
app  
config  
db  
.  
.  
.

do I put my\_app into public\_html? then that causes the problem things  
like the “DB” folder being exposed.

thanks

---

<div class="post-metadata">

**Author:** ![cdvr](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/b38774/32.png) [@cdvr](https://www.ruby-forum.com/u/cdvr)\
**Post date:** [January 18, 2007, 4:50pm UTC](https://www.ruby-forum.com/t/deploying-an-application-to-the-web/82236/5 "2007-01-18T16:50:16Z")

</div>

cdvr wrote:

> do I put my\_app into public\_html? then that causes the problem things  
> like the “DB” folder being exposed.

Look “Capistrano” up. It automates a system for uploading things to a  
server. No more SCP-ing individual files in by hand, setting their  
permissions, etc.

To bypass Capistrano (_temporarily_, before you activate it), try this:

- Put your Rails app in a folder next to public\_html
- reconcile public\_html/.htaccess and app/public/.htaccess
- reconcile the matching public/dispatch\* files
- recycle public\_html
- make a symlink (ln -s) from app/public to public\_html

Now the warning label. ONLY do that as an experiment, along the way  
towards installing Capistrano. Once you do, erase the public\_html  
symlink, and symlink from releases/current/public to public\_html.

–  
Phlip  
[http://c2.com/cgi/wiki?ZeekLand](http://c2.com/cgi/wiki?ZeekLand) ← NOT a blog!!
