Getting Started With Mongrel2

This is the fastest way to get started with Mongrel2. Nothing is really explained, just all the stuff you need is setup and you get to run a few commands. If you want very good explanations for all of this, go read The Mongrel2 Manual a complete manual covering everything from getting started, to writing your first handlers.

This getting started assumes you know what you're doing and can run commands in Unix.

Building The Dependencies

Here's how I might do it on ArchLinux:

# install ZeroMQ 
wget http://download.zeromq.org/zeromq-2.1.7.tar.gz 
tar -xzvf zeromq-2.1.7.tar.gz 
cd zeromq-2.1.7/ 
./configure 
make 
sudo make install 

# install sqlite3 
sudo pacman -S sqlite3 

Getting The Source

Quickest way to do that is to grab the tarball

wget https://github.com/zedshaw/mongrel2/releases/download/v1.9.1/mongrel2-v1.9.1.tar.gz

Building Mongrel2

Now you need to build mongrel2:

tar -xzvf mongrel2-v1.9.1.tar.gz
cd mongrel2-v1.9.1/
make clean all && sudo make install

The version number for your directory might be different since we update it frequently.

Configuring The First Time

Now you can try out the simplest config example and get it running:

cp examples/configs/sample.conf mysite.conf
m2sh load -config mysite.conf
ls config.sqlite

NOTE: There's also other examples in examples/*.conf.

Running Mongrel2

Now you can run this and try it. Make sure you're still in the mongrel2 source directory:

mkdir run logs tmp
m2sh start -host localhost

From another window do:

curl http://localhost:6767/tests/sample.html
hi there

Shutting Down

Just do CTRL-C and it'll exit. m2sh has many other commands and some of them shut things down or restart. Run m2sh help to find out more.

Learn More From The Manual

That is the fastest crash course you can get in running Mongrel2. You should now go read The Mongrel2 Manual (HTML) which we took much more time writing and making very nice for you.