# Ruby site structure on Apache

**URL:** <https://www.ruby-forum.com/t/ruby-site-structure-on-apache/72986>\
**Category:** Rails\
**Created:** [February 24, 2006, 8:31pm UTC](https://www.ruby-forum.com/t/ruby-site-structure-on-apache/72986 "2006-02-24T20:31:30Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![mslagell](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/e274bd/32.png) [@mslagell](https://www.ruby-forum.com/u/mslagell)\
**Post date:** [February 24, 2006, 8:31pm UTC](https://www.ruby-forum.com/t/ruby-site-structure-on-apache/72986/1 "2006-02-24T20:31:30Z")

</div>

I use a hosting company,it use appache for RoR

I test a ‘hello word’ code here

[http://www.smtservers.com/demo/](http://www.smtservers.com/demo/)

I can see the working code here

[http://www.smtservers.com/demo/public/say/hello](http://www.smtservers.com/demo/public/say/hello)

My question is how to short the url like

[http://www.smtservers.com/demo/say/hello.I](http://www.smtservers.com/demo/say/hello.I) do not like public always in  
URL

Thanks for help

Mark

---

<div class="post-metadata">

**Author:** ![mslagell](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/e274bd/32.png) [@mslagell](https://www.ruby-forum.com/u/mslagell)\
**Post date:** [February 24, 2006, 8:38pm UTC](https://www.ruby-forum.com/t/ruby-site-structure-on-apache/72986/2 "2006-02-24T20:38:53Z")

</div>

You need to make the document root RAILS\_ROOT/public, not RAILS\_ROOT.  
There’s absolutely no reason your rails code needs to be available  
over HTTP, and in fact is a security risk. Consider that anyone can  
go to config/database.yml and see your connection info.

If you can’t explicitly set the docroot to RAILS\_ROOT/public, then you  
should put your app in a non HTTP-accessible folder and use a symlink.

Pat

---

<div class="post-metadata">

**Author:** ![mslagell](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/e274bd/32.png) [@mslagell](https://www.ruby-forum.com/u/mslagell)\
**Post date:** [February 24, 2006, 8:54pm UTC](https://www.ruby-forum.com/t/ruby-site-structure-on-apache/72986/3 "2006-02-24T20:54:47Z")

</div>

How to use symlink.I do not understand.Thanks

Mark  
Pat M. wrote:

> You need to make the document root RAILS\_ROOT/public, not RAILS\_ROOT.  
> There’s absolutely no reason your rails code needs to be available  
> over HTTP, and in fact is a security risk. Consider that anyone can  
> go to config/database.yml and see your connection info.
> 
> If you can’t explicitly set the docroot to RAILS\_ROOT/public, then you  
> should put your app in a non HTTP-accessible folder and use a symlink.
> 
> Pat

---

<div class="post-metadata">

**Author:** ![mslagell](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/e274bd/32.png) [@mslagell](https://www.ruby-forum.com/u/mslagell)\
**Post date:** [February 24, 2006, 9:06pm UTC](https://www.ruby-forum.com/t/ruby-site-structure-on-apache/72986/4 "2006-02-24T21:06:05Z")

</div>

On 2/24/06, mark sheran [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> How to use symlink.I do not understand.Thanks

The command is “ln -s”. Try “man ln” or Google to figure out how to use  
it.

I have to reiterate a suggestion already made to you, which is that  
you should figure out how Rails and Ruby work first before worrying  
about all of these deployment issues. That stuff is so far down the  
line before it’s ever going to matter to you.

Posting several variations of “My server is broke, why?” isn’t really  
helping other people help you. If you have specific error messages or  
log entries that don’t make sense to you, post those.

– James

---

<div class="post-metadata">

**Author:** ![mslagell](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/e274bd/32.png) [@mslagell](https://www.ruby-forum.com/u/mslagell)\
**Post date:** [February 24, 2006, 10:34pm UTC](https://www.ruby-forum.com/t/ruby-site-structure-on-apache/72986/5 "2006-02-24T22:34:06Z")

</div>

James L. wrote:

> On 2/24/06, mark sheran [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:
> 
> > How to use symlink.I do not understand.Thanks
> 
> The command is “ln -s”. Try “man ln” or Google to figure out how to use  
> it.
> 
> I have to reiterate a suggestion already made to you, which is that  
> you should figure out how Rails and Ruby work first before worrying  
> about all of these deployment issues. That stuff is so far down the  
> line before it’s ever going to matter to you.
> 
> Posting several variations of “My server is broke, why?” isn’t really  
> helping other people help you. If you have specific error messages or  
> log entries that don’t make sense to you, post those.
> 
> – James

ln is a shell command,I know it affect shell command but I do not know  
how it affect URL access.do I have to change someconfig file of Apache?

Thanks

Mark

---

<div class="post-metadata">

**Author:** ![mslagell](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/e274bd/32.png) [@mslagell](https://www.ruby-forum.com/u/mslagell)\
**Post date:** [February 25, 2006, 12:29am UTC](https://www.ruby-forum.com/t/ruby-site-structure-on-apache/72986/6 "2006-02-25T00:29:10Z")

</div>

On Feb 24, 2006, at 1:34 PM, mark sheran wrote:

> > about all of these deployment issues. That stuff is so far down the  
> > how it affect URL access.do I have to change someconfig file of  
> > Apache?
> 
> Thanks
> 
> Mark

OK Mark-

```
Lets see if we can solve this for you once and for all. but i agree

```

with everyone else here in saying that you shoudlnt worry about  
deploying to your web hosts server until you are more experienced.  
You should use webrick to develop locally and then worry about it a  
bit later when you’ve gotten your feet wet.

```
As to the current problem of ln-s for the symlink:

```

Lets assume that your directory structure is like this: /home/mark/  
htdocs What you will want to do is place your rails application  
right inside your home folder liek this:

/home/mark/railsapp

Now you need to symlink your railsapp/public directory to the htdocs  
folder of your home dir with this command

ln -s /home/mark/railsapp/public /home/mark/htdocs

Then you should be set up to run your hello world.

Cheers0  
-Ezra Z.  
Yakima Herald-Republic  
WebMaster

> **[yakimaherald.com | Yakima, Washington - We Tell Your Stories](https://www.yakimaherald.com/)**

509-577-7732  
removed\_email\_address@domain.invalid

---

<div class="post-metadata">

**Author:** ![mslagell](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/e274bd/32.png) [@mslagell](https://www.ruby-forum.com/u/mslagell)\
**Post date:** [February 25, 2006, 3:58am UTC](https://www.ruby-forum.com/t/ruby-site-structure-on-apache/72986/7 "2006-02-25T03:58:04Z")

</div>

I get the error when I try ln -s /home/mark/railsapp/public  
/home/mark/htdocs

“hard link not allowed for directory”

how to do with this?Thanks

Mark

mark sheran wrote:

> Do you mean I only run the command once
> 
> ln -s /home/mark/railsapp/public /home/mark/htdocs
> 
> then the server can remember forever.I do not need change setting files.
> 
> I ask my hosting company.he ask me change .htaccess.I do not know how.
> 
> Thanks
> 
> Mark
> 
> Ezra Z. wrote:
> 
> > On Feb 24, 2006, at 1:34 PM, mark sheran wrote:
> > 
> > > > about all of these deployment issues. That stuff is so far down the  
> > > > how it affect URL access.do I have to change someconfig file of  
> > > > Apache?
> > > 
> > > Thanks
> > > 
> > > Mark
> > 
> > OK Mark-
> > 
> > Lets see if we can solve this for you once and for all. but i agree  
> > with everyone else here in saying that you shoudlnt worry about  
> > deploying to your web hosts server until you are more experienced.  
> > You should use webrick to develop locally and then worry about it a  
> > bit later when you’ve gotten your feet wet.
> > 
> > As to the current problem of ln-s for the symlink:
> > 
> > Lets assume that your directory structure is like this: /home/mark/  
> > htdocs What you will want to do is place your rails application  
> > right inside your home folder liek this:
> > 
> > /home/mark/railsapp
> > 
> > Now you need to symlink your railsapp/public directory to the htdocs  
> > folder of your home dir with this command
> > 
> > ln -s /home/mark/railsapp/public /home/mark/htdocs
> > 
> > Then you should be set up to run your hello world.
> > 
> > Cheers0  
> > -Ezra Z.  
> > Yakima Herald-Republic  
> > WebMaster  
> > [http://yakimaherald.com](http://yakimaherald.com)  
> > 509-577-7732  
> > removed\_email\_address@domain.invalid

---

<div class="post-metadata">

**Author:** ![mslagell](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/e274bd/32.png) [@mslagell](https://www.ruby-forum.com/u/mslagell)\
**Post date:** [February 25, 2006, 6:19am UTC](https://www.ruby-forum.com/t/ruby-site-structure-on-apache/72986/8 "2006-02-25T06:19:02Z")

</div>

I think you might need to erase the /home/mark/htdocs folder and then  
run the command again. AQnd it will only need to be done once and it  
will stay set.

-Ezra

---

<div class="post-metadata">

**Author:** ![mslagell](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/e274bd/32.png) [@mslagell](https://www.ruby-forum.com/u/mslagell)\
**Post date:** [February 25, 2006, 3:37am UTC](https://www.ruby-forum.com/t/ruby-site-structure-on-apache/72986/9 "2006-02-25T03:37:55Z")

</div>

Do you mean I only run the command once

ln -s /home/mark/railsapp/public /home/mark/htdocs

then the server can remember forever.I do not need change setting files.

I ask my hosting company.he ask me change .htaccess.I do not know how.

Thanks

Mark

Ezra Z. wrote:

> On Feb 24, 2006, at 1:34 PM, mark sheran wrote:
> 
> > > about all of these deployment issues. That stuff is so far down the  
> > > how it affect URL access.do I have to change someconfig file of  
> > > Apache?
> > 
> > Thanks
> > 
> > Mark
> 
> OK Mark-
> 
> Lets see if we can solve this for you once and for all. but i agree  
> with everyone else here in saying that you shoudlnt worry about  
> deploying to your web hosts server until you are more experienced.  
> You should use webrick to develop locally and then worry about it a  
> bit later when you’ve gotten your feet wet.
> 
> As to the current problem of ln-s for the symlink:
> 
> Lets assume that your directory structure is like this: /home/mark/  
> htdocs What you will want to do is place your rails application  
> right inside your home folder liek this:
> 
> /home/mark/railsapp
> 
> Now you need to symlink your railsapp/public directory to the htdocs  
> folder of your home dir with this command
> 
> ln -s /home/mark/railsapp/public /home/mark/htdocs
> 
> Then you should be set up to run your hello world.
> 
> Cheers0  
> -Ezra Z.  
> Yakima Herald-Republic  
> WebMaster  
> [http://yakimaherald.com](http://yakimaherald.com)  
> 509-577-7732  
> removed\_email\_address@domain.invalid
