NEKR .a2z.red

Perl/CGI Setup on an Ubuntu server with Virtualmin

  1. Login as user or root at https://DOMAIN.TLD:10000 or https://SUB.DOMAIN.TLD:10000
  2. Go to or select your domain in the left column under Virtualmin tab
    1. Web Configuration
    2. -> Website Options
      1. CGI script execution mode -> FCGIwrap server
      2. Redirect all requests to SSL site -> yes (optional)
    1. Web Configuration
    2. -> Configure SSL Website
    3. Under 'Virtual Server Options,' click Directory '/home/USERNAME/public_html' under 'Per Directory Options'
    4. click 'Document Options'
      1. Set the following options after clicking 'Selected below'
        1. Execute CGI programs -> Yes
        2. Follow symbolic links -> Yes
        3. Server-side includes and execs -> Yes
        4. Server-side includes -> Yes
        5. Generate directory indexes -> No
        6. Generate Multiviews -> No
        7. Follow symbolic links if owners match -> Yes
      2. Click Save
    1. Go / Return to MIME types
    2. Under 'content handlers,'
      1. Select cgi-script for 'Handler'
      2. type .cgi for 'Extensions'
    3. Click Save
    1. Click 'Apply Configuration' on the top right corner
    1. Test/Refresh your CGI script/page/URL
      1. Login to your server via SSH
      2. Run 'cpan install Mojolicious
    2. Save the following lines in a file, e.g., index.cgi
      1. #!/usr/bin/perl
      2. use Mojolicious::Lite -signatures;
      3. get '/' => sub ($c) { $c->render('default'); };
      4. app->start;
      5. 1;
      6. __DATA__
      7. @@ default.html.ep
      8. Hello World
    3. Set file permission to '0755' (execute mode)
      1. Click File Manager under Virtualmin
      2. Go to public_html
      3. Check mark the file 'index.cgi'
      4. Go to 'Tools' -> 'File Permissions'
      5. Owner: Read Write Execute
      6. Group: Read Execute
      7. Others: Read Execute
      8. Click Change
      9. or, type 0755 in the text box for 'Mode' and click Change
      10. or run 'cd public_html' and 'chmod +x index.cgi' when logged into your server via ssh as user/root
    4. open your file in a browser: https://Domain.tld/index.cgi
    5. It should just say 'Hello World' on the browser