How to install the web framework Mojolicious and run the web application

Learn how to install the web framework Mojolicious and run web applications. In the introduction to Ubuntu server construction, we will disclose the minimum knowledge necessary for building an environment for developing Perl Web systems.

Prerequisites for installing the web framework Mojolicious

As a prerequisite to installing the web framework Mojolicious, the users Perl and cpanm must be installed.

Installing the web framework Mojolicious

Install the web framework Mojolicious.

cpanm Mojolicious

Make sure you have Mojolicious installed. It's okay if no error occurs.

perl -e'use Mojolicious'

The smallest Mojolicious application

Let's create a Mojolicious application.

Save the following Mojolicious program as "".

use Mojolicious::Lite;
get'/' => {text =>'Hello World!'};

Launch a web application for the development environment

The morbo command launches the web application in the development environment.


The web application starts on port 3000.

Web application available at is the address of the local server. Change this part to the IP address of your server and access it from your browser.

If port 3000 is not open on your VPS or cloud server, you will not be able to access it, so allow port 3000.

The following example is an example where the IP address of the server is "".

If "Hello World!" Is displayed on the screen, it is successful.

Launch a web application for production environment

Next, let's start the web application for the production environment. The hypnotoad command launches the web application for production.


The web application starts on port 8080.

Web application available at

When you reboot, try again.


Use the "--stop" option to stop.

hypnotoad --stop

Connect Mojolicious apps from a reverse proxy

In the production environment, connect the web application started by hypnotoad from a web server such as Apache with a reverse proxy.

Please refer to the following for this procedure.

Associated Information