Mojolicious, Nginx and FastCGI

To use Mojolicious under nginx you should first install Mojo::Server::FCGI. We are going to use fcgi_prefork server, since we need a manager. Nginx configuration file needs a couple tweaks. Here is a config:

server {
    listen   80; 


    access_log  /var/log/nginx/;

    location / { 
        root /var/www/nginx/;

        # Our Mojolicious app runs on this address

        # Default fastcgi parameters
        include /etc/nginx/fastcgi_params;

        # Fixes
        fastcgi_param  PATH_INFO          $fastcgi_script_name;

Then run your Mojolicious application as:

$ perl my_app fcgi_prefork
Server available at :3000.

Start nginx. Enjoy.


blog comments powered by Disqus