L1VM - CGI
This is an example how to use L1VM as a CGI Common Gateway Interface tool. I use lighttpd as the webserver. And do include an example config. With CGI it is possible to run scripts or programs on the webserver side. This scripts are run by the webserver and can output text and HTML back into the browser window. The L1VM gets called from the webpage if the “time” link is clicked. You can send the text input from a webpage to a CGI program. Here the L1VM program is showing the current time and date. It just shows the output of the “print” commands as a webpage in the browser. I also included an example how to use a formular and get the text input into the L1VM CGI program. This is just an example how to get the input from the server ENV variable. See program “adduser.l1com”.
You should add your own SSL certificate to the lighttpd webserver: As root type in the following:
# cd /etc/lighttpd
# mkdir certs
# cd certs
# openssl req -new -x509 -keyout lighttpd.pem -out lighttpd.pem -days 365 -nodes
You have to answer a few questions while generating the certificate.
I did enable SSL in my lighttpd config file, so it should work after generating the SSL certificate.
I included a sample config for the lighttpd webserver: “lighttpd.conf” Just copy the “web” folder into your “/home” directory. And change the path in the config file to your user name!
server.document-root = "/home/stefan/web"
Run the server with the bash script. Now you can open the webpage in your browser:
If you click on the “time” link the L1VM program is called as CGI and shows the current time and date!
This is a good starting point to do more like this!