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