The Mako Server is extremely easy to deploy (install) since only one file is required. The server does not need installation and can be run in a command window. On Windows, the server can optionally be installed as a Windows service. On all other platforms, the server can optionally be installed as a daemon (background) process.
Example, load one non-deployed application as a root application:
See Loading Applications for more information.
You can specify the location of an optional configuration file. The server will try to load "mako.conf"in the following locations if you do not explicitly specify where you have your configuration file: in the directory where the Mako Server is installed, in the current directory, and in the current user's home directory.
See Configuration File for more information on how to use a configuration file.
-d (Run in daemon mode) is typically used by a startup script that runs at system start and that starts the server as a background process. You do not use this mode when you develop LSP applications. See the Installing Mako Server as a Service on Linux tutorial for more information on using this option.
-u username (Username to run as) is used when starting the server as the user "root" (superuser) and then later changing the user. This command makes it possible for the server to open port 80 and 443, which can only be opened by the root user. Servers should typically not run as root, thus the -u command makes it possible to change the user ID from the superuser to a regular user after the ports are opened.Example:
Note: the server will open alternate ports above 1024 if it is unable to open the default ports.
An alternative to using the above command is to add the CAP_NET_BIND_SERVICE capability, which is explicitly defined as the capacity for an executable to bind to a port less than 1024, including when run as a non root Linux user.
The above commands are for installing and managing the server as a Windows service. For example, the following command installs the server as a service, enables auto start, and starts the service:
On Windows 7, administrative privileges are required in order to install a service. The Mako Server will request elevated permissions if the process or command window from where the service is installed does not run with elevated permissions.
Applications are loaded by using the -l command. The server will simply return a 404 not found message if you start the server without loading any applications.
A traditional web server typically uses one pre-configured directory on your hard drive for your web pages. The Mako server works differently as it allows you to load multiple applications. The applications can be loaded by using the -l (load command) and/or by using the configuration file.
The following example loads three applications:
The two myapp applications have the same base URI, but the non-deployed application has a higher priority than the deployed application myapp.zip. This means that resources are initially searched for in the non-deployed application and then fall back to the deployed application if not found in the non-deployed application. The last application loaded is a non deployed root application.
The configuration file lets you customize the server's initialization of the Barracuda Web Server and perform other initialization tasks. You can also use the configuration file for loading applications and setting your own configuration parameters.
If you do not specify a configuration file by using the "-c" option, the Mako Server looks for a configuration file by the name mako.conf in the following directories:
Port and interface configuration:
SSL certificate and private key management (The default is to use a self signed certificate integrated into the Mako Server):
In addition to the -l load command, applications can be loaded by creating an array of apps to load.
The following example loads three applications, the first application is provided as a string and the other two applications are provided as a Lua table. Providing a Lua table allows for more configuration options. The last application is loaded as a root application since we set the name to an empty string. The first application's name is set to the name of the directory 'app1'.
Each table in the 'apps' array can have the following attributes:
You can setup a basic user database that can be used by the dav server(s). The "users" key must be set to a table with key-value pairs, where the key is the username and the value is the password in clear text.Example:
See the Installing Mako Server as a Service on Linux tutorial for more information on using the 'dav' option and setting up a user database.
Enable the TraceLogger by setting the following attribute:
When the TraceLogger is enabled, navigate to http://your-server/rtl/tracelogger/
You can set your own parameters in the configuration file and then access the configuration parameters from the loaded LSP applications. The configuration parameters are made available as a Lua module.Example:
In the configuration file:
myparam="This is my custom parameter"
In your Lua code, load the configuration table as follows:
local conf=require"loadconf" print(conf.myparam) -- prints "This is my custom parameter"
The Barracuda Application Server powering the Mako Server is designed for deep embedded systems where one may have requirements on resource allocation. The server is therefore designed such that one must pre-allocate the number of resources required. The following allows you to modify these settings. See the C reference manual for detailed information.