# Script/server with options

**URL:** <https://www.ruby-forum.com/t/script-server-with-options/114555>\
**Category:** Rails\
**Created:** [September 14, 2007, 10:41pm UTC](https://www.ruby-forum.com/t/script-server-with-options/114555 "2007-09-14T22:41:54Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![byrnejb](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/d2c977/32.png) [@byrnejb](https://www.ruby-forum.com/u/byrnejb)\
**Post date:** [September 14, 2007, 10:41pm UTC](https://www.ruby-forum.com/t/script-server-with-options/114555/1 "2007-09-14T22:41:54Z")

</div>

I have hacked a script that I found at [http://www.koders.com/ruby](http://www.koders.com/ruby) into a  
generalized webrick startup script. The script is attached to this post  
and the help text is reproduced below. “script/server” runs webrick on  
port 3000 bound to 0.0.0.0. If that is too general then you can pass a  
specific port using -p= or --port=. “script/server -s” runs webrick in  
ssl mode and generates a self-signed certificate. The other options are,  
I hope, fairly self-explanatory.

script/server  
Usage: ruby server [options]  
With all defaults runs Webrick in standard http mode  
listening on port 3000 for all configured addresses. If  
-s | --sslmode then the server will start in https mode  
on port 3000 and auto-generate a self-signed certificate.  
If --sslauto=off then you must provide a server key  
and certificate within the RAILS\_ROOT.

```
-b, --binding=ip Binds Rails to the specified ip.
                                 Default: 0.0.0.0 - listen on all

```

addresses  
-c, --charset=charset Set default charset for output.  
Default: UTF-8  
-d, --daemon Make Rails run as a Daemon (only  
works  
if fork is available – meaning on \*nix).  
-e, --environment=name Specifies the environment to run  
this  
server under (test/development/production).  
Default: development  
-h, --help Print this help text.  
-m, --mime-types=filename Specifies an Apache style  
mime.types  
configuration file to be used for mime types  
Default: none  
-p, --port=port Runs Rails on the specified port.  
Default: 3000  
–sslcert=/path/to/certificate  
For SSL (https) operation pass the  
server  
certificate file location relative to RAILS\_ROOT.  
default: /config/ssl/server.key  
–sslkey=/path/to/key For SSL (https) operation pass the  
server  
key file location relative to RAILS\_ROOT.  
default: /config/ssl/server.key  
-s, --sslmode Run server in SSL (https) mode.  
–sslroot=/path/to/root\_cert For SSL (https) operation pass the  
Certificate Authority root file location relative to  
RAILS\_ROOT.  
default:  
/config/ssl/rails\_root\_ca.crt  
–sslself=on|off Generate self-signed SSL  
certificate.  
Default: on

---

<div class="post-metadata">

**Author:** ![byrnejb](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/d2c977/32.png) [@byrnejb](https://www.ruby-forum.com/u/byrnejb)\
**Post date:** [September 14, 2007, 10:48pm UTC](https://www.ruby-forum.com/t/script-server-with-options/114555/2 "2007-09-14T22:48:57Z")

</div>

And as soon as I reviewed this online I noticed an error in the banner.  
Here is the corrected script and help text:

script/server  
Usage: ruby server [options]  
With all defaults runs Webrick in standard http mode  
listening on port 3000 for all configured addresses. If  
-s | --sslmode then the server will start in https mode  
on port 3000 and auto-generate a self-signed certificate.  
If --sslself=off then you must provide a server key  
and certificate within the RAILS\_ROOT.

```
        ...
```
