# Cant auto-start Ruby on lighthttpd

**URL:** <https://www.ruby-forum.com/t/cant-auto-start-ruby-on-lighthttpd/143346>\
**Category:** Deployment\
**Created:** [July 17, 2008, 4:27pm UTC](https://www.ruby-forum.com/t/cant-auto-start-ruby-on-lighthttpd/143346 "2008-07-17T16:27:14Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![adithecool](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/dfb087/32.png) [@adithecool](https://www.ruby-forum.com/u/adithecool)\
**Post date:** [July 17, 2008, 4:27pm UTC](https://www.ruby-forum.com/t/cant-auto-start-ruby-on-lighthttpd/143346/1 "2008-07-17T16:27:14Z")

</div>

Hi,

I have installed ruby and redmine on my server running lighthttpd. I  
wanted to run ruby on a different port (3000). The problem is I cant get  
it to auto-start, I have to manually type in: ruby server/script -e  
production -p 3000  
and after that I do not get the cursor back, I have to press Ctrl+C to  
shut down the server and come back to command line. I’ve also noticed  
that all the access entries are echoed on the CLI if I start it manually  
and leave it running. I’ve tried googling and ended up here. Hopefully  
someone will be able to point me in the right direction

Thanks.

---

<div class="post-metadata">

**Author:** ![adithecool](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/dfb087/32.png) [@adithecool](https://www.ruby-forum.com/u/adithecool)\
**Post date:** [July 17, 2008, 7:41pm UTC](https://www.ruby-forum.com/t/cant-auto-start-ruby-on-lighthttpd/143346/2 "2008-07-17T19:41:22Z")

</div>

When you type ruby script/server you are actually starting a  
webserver. The -p puts it on port 3000. This is technically not  
starting ruby… Lighttpd is also a web server so if you are trying to  
run both commands you are duplicating some effort. What you want to  
do is first check that lighttpd is running on your machine (no idea  
what platform you are on)

If you need a sample lighttpd configuration, here’s an old one that  
might get you started:

[NameBright - Coming Soon](http://www.urbanpuddle.com/edgy.lighttpd.conf). You’ll want to  
uncomment the ruby rails block and comment out the PHP stuff. You set  
the port by changing the value of server.port from 80 to something  
else.

Once you have lighttpd setup, you should be able to reboot and have  
everything work. The full link to the tutorial is here:  
[http://www.urbanpuddle.com/articles/2006/12/07/install-ruby-rails-on-ubuntu-edgy-eft](http://www.urbanpuddle.com/articles/2006/12/07/install-ruby-rails-on-ubuntu-edgy-eft)  
but is quite old.

Good luck,  
Vince

On Thu, Jul 17, 2008 at 10:27 AM, Aadi Ebu  
[removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> and leave it running. I’ve tried googling and ended up here. Hopefully  
> someone will be able to point me in the right direction
> 
> ## Thanks.
> 
> Posted via [http://www.ruby-forum.com/](http://www.ruby-forum.com/).
> 
> >

–  
support independent business – [http://www.buyindie.net/](http://www.buyindie.net/)

---

<div class="post-metadata">

**Author:** ![adithecool](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/dfb087/32.png) [@adithecool](https://www.ruby-forum.com/u/adithecool)\
**Post date:** [July 18, 2008, 3:35pm UTC](https://www.ruby-forum.com/t/cant-auto-start-ruby-on-lighthttpd/143346/3 "2008-07-18T15:35:59Z")

</div>

Thanks for the help Vince. I did try it but it didnt work. Let me  
explain a bit more of my situation.

I have Linux with CentOS 4 and running lighttpd. Its works perfect. What  
I wanted was to run ruby on port 3000. I need to run a SVN service  
called redmine. I did have the ruby rails block in my lighttpd.conf  
file:

$HTTP[“url”] =~ “/redmine” {  
server.document-root = “/var/www/redmine/public/”  
server.port = 3000  
alias.url = ( “/redmine/” =\> “/var/www/redmine/public/” )  
server.indexfiles = (“dispatch.fcgi”)  
server.error-handler-404 = “/redmine/dispatch.fcgi”  
url.rewrite = ( "^/$ =\> “index.html”, “^([^.]+)$” =\> “$1.html” )

fastcgi.server = (  
(“/redmine” =\>  
(  
“socket” =\> “/tmp/example.socket”,  
“bin-path” =\> “/usr/bin/ruby  
/var/www/redmine/public/dispatch.fcgi”,  
“bin-environment” =\> (“RAILS\_ENV” =\> “production”)  
“idle-timeout” =\> 120,  
“check-local” =\> disable,  
“min-procs” =\> 1,  
“max-procs” =\> 4,  
)))  
}

When I try to access [www.example.com:3000/redmine](http://www.example.com:3000/redmine) I get Failed to  
Connect error.

Hope this is helpful and thanks for helping out.

Vince W. wrote:

> When you type ruby script/server you are actually starting a  
> webserver. The -p puts it on port 3000. This is technically not  
> starting ruby… Lighttpd is also a web server so if you are trying to  
> run both commands you are duplicating some effort. What you want to  
> do is first check that lighttpd is running on your machine (no idea  
> what platform you are on)
> 
> If you need a sample lighttpd configuration, here’s an old one that  
> might get you started:
> 
> [NameBright - Coming Soon](http://www.urbanpuddle.com/edgy.lighttpd.conf). You’ll want to  
> uncomment the ruby rails block and comment out the PHP stuff. You set  
> the port by changing the value of server.port from 80 to something  
> else.
> 
> Once you have lighttpd setup, you should be able to reboot and have  
> everything work. The full link to the tutorial is here:  
> [NameBright - Coming Soon](http://www.urbanpuddle.com/articles/2006/12/07/install-ruby-rails-on-ubuntu-edgy-eft)  
> but is quite old.
> 
> Good luck,  
> Vince

---

<div class="post-metadata">

**Author:** ![adithecool](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/dfb087/32.png) [@adithecool](https://www.ruby-forum.com/u/adithecool)\
**Post date:** [July 18, 2008, 6:22pm UTC](https://www.ruby-forum.com/t/cant-auto-start-ruby-on-lighthttpd/143346/4 "2008-07-18T18:22:18Z")

</div>

Well, I’m not the expert on mapping lighttpd to a domain (e.g.  
[example.com/redmine](http://example.com/redmine) vs just [example.com](http://example.com)) so your issue could be there.

Otherwise I have to suggest the basic stuff:

1. Make sure permissions are ok on your rails folder (I use  
www-data:www-data)
2. Make sure the app starts and runs ok using webrick or mongrel only  
from the script/server command.

cheers,  
Vince

On Fri, Jul 18, 2008 at 9:35 AM, Aadi Ebu  
[removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> server.document-root = “/var/www/redmine/public/”  
> “bin-path” =\> "/usr/bin/ruby  
> Connect error.
> 
> > run both commands you are duplicating some effort. What you want to

–  
support independent business – [http://www.buyindie.net/](http://www.buyindie.net/)
