newLISP Fan Club

Forum => newLISP in the real world => Topic started by: joejoe on February 22, 2011, 04:14:17 PM

Title: Simple nL Web Page in http mode
Post by: joejoe on February 22, 2011, 04:14:17 PM
Hi -



I am working on my local machine (Linux Mint < Ubuntu < Debian) and trying to get a simple web page to load.



I ran this newLISP command to get the server running:



newlisp -http -d 8080 -w /home/joe/newlisping/web



And inside of the web directory I have a file called go.lsp which is this:


#!/usr/bin/newlisp
#
# First newLISP from-scratch web site :D


(print "Content-Type: text/htmlrnrn")
(println "<h3>My 1st newLISP Web Site! :D</h3>n")

(exit)


When I take Firefox to /home/joe/newlisping/web/go.lsp I see the file contents, not a web page.



I even tried to chmod 755 the file but still only see the file contents.



Any quick pointer would be great! Thanks!!



newLISP v.10.2.8 on Linux IPv4 UTF-8
Title: Re: Simple nL Web Page in http mode
Post by: Lutz on February 22, 2011, 04:35:19 PM
Two things:



1.) Rename go.lsp to go.cgi. newLISP server only recognizes files with the extension .cgi as CGI files, else it will display the contents or html.



2.) Type this into your browser http://localhost:8080/go.cgi

If you just type the file-path of your file newLISP server will not get involved at all, and Firefox will always display only the contents of the file, no matter what extension.
Title: Re: Simple nL Web Page in http mode
Post by: joejoe on February 22, 2011, 04:42:16 PM
Woo-hoo!!! :D



Now I'm cookin w/ newLISP. :0)



Biggest thank you, Lutz.
Title: Re: Simple nL Web Page in http mode
Post by: joejoe on May 23, 2012, 04:23:48 PM
No longer cookin,



newLISP v.10.3.3 on Linux IPv4/6 UTF-8 on Debian Squeeze i686 GNU/Linux.



I launched the newLISP server with this:


newlisp -http -d 8088 -w /home/joe/nl

Inside my /home/joe/nl directory I have this file:


-rwxr-xr-x 1 joe joe     334 May 23 18:15 index.cgi

with this code:


#!/usr/bin/newlisp

(load "Web.lsp")

(print "Content-Type: text/htmlrnrn")
(println "<h3>My 1st newLISP Web Site! :D</h3>n")

(exit)


The /home/joe/nl directory is chmod 755.



Loading the index in my browser w/ this url:



localhost:8088/index.cgi



makes the nL server print out this error:


sh: 1: ./index.cgi: not found

I can verify that the directory is correct because I created a test.txt file and can see that fine.



Did something change from 10.2.8 to 10.3.3 that might affect loading the index.cgi?



Thanks!
Title: Re: Simple nL Web Page in http mode
Post by: Lutz on May 25, 2012, 06:34:33 AM
Does #!/usr/bin/newlisp refer to the correct path in your newLISP installation?
Title: Re: Simple nL Web Page in http mode
Post by: joejoe on May 25, 2012, 12:55:50 PM
QuoteDoes #!/usr/bin/newlisp refer to the correct path in your newLISP installation?


doh!



I changed it to /usr/local/bin/newlisp and corrected my module loading to this:


(module "web.lsp")

and Im cookin again! Thanks very much, Lutz! Wont make that mistake again.