NS30 .bizland.us
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 CPAN DateTime Cpanel::JSON::XS CryptX EV IO::Socket::Socks IO::Socket::SSL Net::DNS::Native Role::Tiny Future::AsyncAwait 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__
- @@ layouts/default.html.ep
- <!doctype html>
- <html lang="en">
- <head>
- <meta charset="utf8">
- <title><%= title %> - Perl Mojolicious App</title>
- <meta name="url" content="https://ns30.bizland.us/index.cgi">
- <meta name="description" content="<%= app->config->{thisapp}->{description} %>">
- <meta name="keywords" content="<%= app->config->{thisapp}->{keywords} %>">
- <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
- <meta name="theme-color" content="#B12A34">
- <meta name="Robots" content="INDEX,FOLLOW">
- <meta name="Rating" content="General">
- <link rel="icon" href="favicon.ico">
- <link rel="apple-touch-icon" href="/favicon.ico">
- <link rel="manifest" href="//ns30.bizland.us/assets/manifest.json">
- <link rel="stylesheet" href="//ns30.bizland.us/assets/default.css">
- </head>
- <body>
- <%= content %>
-
- <footer class="container-fluid">
- <div class="rights" id="rights">
- © <a href="//ns30.bizland.us" title="All rights reserved by " BizLand Hosting " - www.BizLand.us">ns30.bizland.us</a>
- <span id="what-is-my-ip-address"></span>
- </div>
- <div class="ads" id="ads"></div>
- </footer>
-
- <script defer src="/assets/node_modules/jquery/dist/jquery.min.js"></script>
- <script defer src="/assets/node_modules/bootstrap/dist/js/bootstrap.min.js"></script>
-
- <script>
- // register service worker
- if ('serviceWorker' in navigator) {
- window.addEventListener('load', () => {
- navigator.serviceWorker.register("/assets/service-worker.js")
- .then((reg) => {
- console.log('Service worker "ns30.bizland.us" registered', reg);
- });
- });
- }
- </script>
- <script defer src="/index.cgi/what-is-my-ip-address?_format=js"></script>
-
- </body>
- </html>
-
-
- @@ default.html.ep
- % layout 'default';
- % title 'Home';
-
- <article>
- <h2>Hello World<h2>
- Your IP is <%= $ENV{REMOTE_ADDR} %>
- </article>
-
-
- 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' and show your IP on the browser