hello, world!

This commit is contained in:
Al Beano 2016-08-24 21:43:35 +01:00
parent a2ba18672e
commit 95e1e99be5
2 changed files with 13 additions and 4 deletions

View File

@ -6,7 +6,7 @@ chown www:www /var/www/run
install -o www -g www -m 0400 httpd.conf /etc/
echo "permit nopass root as www" >> /etc/doas.conf
curl -L https://cpanmin.us | perl - App::cpanminus
cpanm -l /var/www/perl5 FCGI
cpanm -l /var/www/perl5 FCGI Switch
perl -I /var/www/perl5/lib/perl5 -MFCGI -M5.010 -e 'say "it works"' # test perl installation
install -o www -g www -m 0500 tormon/* /var/www/tormon/
echo 'echo "Starting tormon" && doas -u www /var/www/tormon/tormon.fcgi &' >> /etc/rc.local

15
tormon/tormon.fcgi Normal file → Executable file
View File

@ -3,6 +3,7 @@ use 5.010;
use strict;
use warnings;
use FCGI;
use Switch;
my $sock = FCGI::OpenSocket(
"/var/www/run/tormon.sock",
@ -19,7 +20,15 @@ my $request = FCGI::Request(
);
while ($request->Accept() <= 0) {
say "Content-Type: text/plain\n\n";
use Data::Dumper;
print Dumper(\%ENV);
print "Content-Type: text/html\n\n";
switch ($ENV{"REQUEST_URI"}) {
case "/debug" {
use Data::Dumper;
print "<textarea>" . Dumper(\%ENV) . "</textarea>";
}
case "/" {
print "Hello, world!";
}
}
}