Problem
- I want to make one of my lisp programs available to the public.
- There exist numerous ways to do that, many use a mod_lisp module for apache. Most possibilities seemed to complicated though. I wanted to make it work fast.
- I want every user on a *nix system to be able to program their own cgi scripts easily.
- This might not be the most secure way to do this! (If security is more important, work with cgi-bin instead of Add Handler?)
- Feel free to ask questions, by editing the page at the bottom (click on Edit on Top).
Solution
- Install Apache
- in Ubuntu via the GUI or apt-get: sudo apt-get install apache2
- in Free BSD via the ports tree su
cd /usr/ports/www/apache2
make install clean - in Windows you might want to use XAMPP - it's the easiest way to install Apache, PHP, mySQL and Perl under Windows. Windows will not be covered here further though.
- in Ubuntu via the GUI or apt-get:
- Activate UserDir in Apache, add (or uncomment) the following line in your apache2.conf (under ubuntu, this file is in /etc/apache2/ ): UserDir public_html
UserDir disabled root - Right after that you need to add the following lines: The Exec CGI? option is especially important here!<Directory /home/*/public_html>
AllowOverride FileInfo AuthConfig
Options SymLinksIfOwnerMatch IncludesNoExec ExecCGI
</Directory> - Add the following line to make Apache execute your files ending with .lsp as CG Is? by adding: AddHandler cgi-script .lsp
- Now you need to create a public_html folder in your home directory
- Place a simple lisp command line script in it. For example the file test.lsp #!/usr/bin/clisp
(print "Hello World. Here clisp goes online!") - Make sure it is marked as executable by going to your public_html folder and type chmod 755 test.lsp
- Now restart your apache2 by typing: apache2ctl graceful
- Afterwards use your browser and type in the following address (Where you of course replace richard with your username ; ) http://127.0.0.1/~richard/test.lsp
- Et voilą, you can show the world you lisp programming skills now
- Attention: It is very important that - once you have set up such a system - you do not let anybody upload files either: to your home directory or with the extension .lsp. This would be an invitation for a breakin and/or a defacement of your server.
References + where to look further
- http://cybertiggyr.com/gene/articles.cgi?category=LISP - awesome website with lots of great information on practical lisp
- http://www.thangorodrim.de/software/lisp-cgi-utils/index.html - Utilities for easier creation of html tags and access to form variables
Questions