We would like to remind you that Mona is licensed under the GNU General Public License, so MonaBase can’t be linked with any closed source project..


A 32-bit Windows zipped package is provided to quickly test MonaServer.

We recommend you to clone the github version from the sources for production use.

If you download the Windows 32-bit binary, then you can skip down to the Configurations section of this document.


In order to use it you need the C++ Redistributable Packages for Visual Studio 2013.


You can download the entire sources with zipball or use a GIT client to clone the following address:


The Mona source code is cross-platform. Supported OS are :

  • Windows (minimum XP)
  • All Linux OS
  • FreeBSD
  • OS-X

If you need to target a specific platform or if you encouter problems during the build please ask us on the forum.

Dependencies and requirements

Mona has the following dependencies :


LuaJIT is an alternative to the official LUA interpreter. It works faster than LUA essentially because it compiles the LUA code to machine code during execution (see LuaJIT performance about performance comparison).

As C++11 is used in MonaServer you need to install a compiler which is compatible. At least gcc/g++ 4.8.2 on Linux/FreeBSD/OS-X and VS 2013 on Windows.

LuaJIT installation

For several reasons some functionalities of LUA 52 are not allowed by default in luajit (like # or pairs()) so we recommend you to compile luajit by yourself and set the DLUAJIT_ENABLE_LUA52COMPAT option.

  • First download the latest release of LuaJIT (here with git) :
    git clone
  • Then set the DLUAJIT_ENABLE_LUA52COMPAT option :
    • On Linux just search DLUAJIT_ENABLE_LUA52COMPAT in src/Makefile and uncomment the line
    • On Windows search the line beginning with @set LJCOMPILE=cl /nologo /c /O2 /W3 /D_CRT_SECURE_NO_DEPRECATE in src/msvcbuild.bat. Then add the /DLUAJIT_ENABLE_LUA52COMPAT option
  • Finally you can compile luajit (make or src/msvcbuild.bat)


On Linux just run sudo make install to install luajit on the system.

Windows Build

First follow the LuaJIT installation steps.

Visual Studio 2013 solution and project files are included. It searches external libraries in External/lib folder and external includes in External/include folder in the root Mona folder. So you must put OpenSSL and LuaJIT headers and libraries in these folders. You can find OpenSSL binaries for windows on Win32OpenSSL.

Unix (Linux/OS-X) Build

First follow the LuaJIT installation steps.

If your Unix system includes a package manager you can quickly install OpenSSL. The package is usually named libssl-dev (or openssl-devel).


  • You need to use the -dev (or -devel) version to get the header files required during Mona compilation,
  • Don’t use clang/llvm on OS-X, use rather gcc.

To build Mona:

$ make

To clean:

$ make clean

Amazon EC2 AMI Build

First follow the LuaJIT installation steps.

Create a standard EC2 AMI with a new security group. Open up all UDP and at least TCP Ports 1935 in the Security Group.

Connect to the AMI and execute the following script:

sudo -s
yum -y groupinstall "Development Tools"
yum -y groupinstall "Development Libraries"
yum -y install make
cd Mona-master
sudo ./MonaServer --daemon

Raspberry PI (armv61) Build

You need to install a distribution where gcc 4.8.2 is available. For now we have only found Raspbian upgraded to the distribution jessie. Here is the protocol to install it correctly :

sudo aptitude update
sudo aptitude dist-upgrade
sudo rpi-update


MonaServer is statically configured by an optional configuration MonaServer.ini file to put in the installation folder. Possible configurations are :

  • host : address like it will be seen by clients and other servers, this option is mandatory to make working all redirection features in multiple server configuration (see Scalability and load-balancing).
  • socketBufferSize : allows to change the size in bytes of sockets reception and sending buffer. Increases this value if your operating system has a default value too lower for important loads.
  • threads : indicates the number of threads which will be allocated in the pool of threads of Mona. Usually it have to be equal to (or greather than) the number of cores on the host machine (virtual or physic cores). By default, an auto-detection system tries to determinate its value, but it can be perfectible on machine who owns hyper-threading technology, or on some operating systems.


  • dir : Directory containing data and www.


  • port : port to receive incoming server connection (in a multiple servers configuration, see Scalability and load-balancing for more details). If you don’t configure this port, MonaServer cannot establish a connection with it.


The exchange between servers is done in a unencrypted TCP way, so to avoid an attack by this incoming end point the servers.port should be protected by a firewall to allow just a connection by an other server and nothing else.

  • targets : list of MonaServer addresses (separated by semicolons) to connect on start-up. When the server will start, it will try to etablish a connection to these addresses every 10 seconds (see Scalability and load-balancing for more details). Each token can include arguments through as a query url form:

It will create dynamic properties on server object (see server object description of “Server application, api” page for more details).

function onServerConnection(server)
  if"master" then -- true here just for server
    NOTE("server master arg = "..server.arg) -- displays here "server master arg = val"


  • port : 1935 by default (RTMFP server default port), set 0 if you want to disable RTMFP.
  • keepaliveServer : time in seconds for periodically sending packets keep-alive with server, 15s by default (valid value is from 5s to 255s).
  • keepalivePeer : time in seconds for periodically sending packets keep-alive between peers, 10s by default (valid value is from 5s to 255s).


  • port : 1935 by default (RTMP server default port), set 0 if you want to disable RTMP.


  • port : 80 by default (HTTP server default port), set 0 if you want to disable HTTP.
  • timeout : 7 by default, it is the maximum time before server kills the connection when no data as been received.
  • index : the default index file of HTTP protocol, if it is specified it will redirect each connection to this index.


  • port : 554 by default (RTSP server default port), set 0 if you want to disable RTSP.


  • timeout : 120 by default, it is the maximum time before server kills the connection when no data as been received.


  • directory : directory where the log files are written (MonaServer/logs by default).
  • name : name of log files (log by default).
  • rotation : number of files to keep in logs directory


Maximum size of a file is 1Mb.

Sample of MonaServer.ini

socketBufferSize = 114688
port = 1985
keepAlivePeer = 10
keepAliveServer = 15

If this configuration file doesn’t exist, default values are used.



MonaServer includes some argument launch options, but by default MonaServer is optimized for a production running. Command-line options are useful during development and test usage. To get full descriptions about the launch arguments start MonaServer with /help argument on Windows or –help on Unix system.

Otherwise, simply start the MonaServer application with administrative rights.

You can also start it as a Windows service:

MonaServer.exe /registerService [/displayName=MonaServer /description="Open Source RTMFP Server" /startup=automatic]

Or an Unix daemon:

sudo ./MonaServer --daemon [--pidfile=/var/run/]


Flash client connects to MonaServer by the classical NetConnection way:


Here the port has its default value 1935. If you configure a different port on MonaServer you have to indicate this port in the URL (after localhost, of course).

The path used allows you to connect for your desired Server Application.


To learn more, read the Server Application or Samples pages.