Page 1 of 1

Simple nL Web Page in http mode

Posted: Wed Feb 23, 2011 12:14 am
by joejoe
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:

Code: Select all

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


(print "Content-Type: text/html\r\n\r\n")
(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

Re: Simple nL Web Page in http mode

Posted: Wed Feb 23, 2011 12:35 am
by Lutz
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.

Re: Simple nL Web Page in http mode

Posted: Wed Feb 23, 2011 12:42 am
by joejoe
Woo-hoo!!! :D

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

Biggest thank you, Lutz.

Re: Simple nL Web Page in http mode

Posted: Wed May 23, 2012 11:23 pm
by joejoe
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:

Code: Select all

newlisp -http -d 8088 -w /home/joe/nl
Inside my /home/joe/nl directory I have this file:

Code: Select all

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

Code: Select all

#!/usr/bin/newlisp

(load "Web.lsp")

(print "Content-Type: text/html\r\n\r\n")
(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:

Code: Select all

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!

Re: Simple nL Web Page in http mode

Posted: Fri May 25, 2012 1:34 pm
by Lutz
Does #!/usr/bin/newlisp refer to the correct path in your newLISP installation?

Re: Simple nL Web Page in http mode

Posted: Fri May 25, 2012 7:55 pm
by joejoe
Does #!/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:

Code: Select all

(module "web.lsp")
and Im cookin again! Thanks very much, Lutz! Wont make that mistake again.