Livecode Server with nginx

Are you using LiveCode to create server scripts or CGIs?

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
bangkok
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 937
Joined: Fri Aug 15, 2008 7:15 am

Livecode Server with nginx

Post by bangkok » Mon Jun 30, 2014 3:27 pm

Do you have any standard configuration file to run LiveCode Server on a nginx server ?

Peter Wood
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 92
Joined: Mon Jul 06, 2009 4:53 am
Location: Bamboo River

Re: Livecode Server with nginx

Post by Peter Wood » Tue Jul 01, 2014 2:42 am

I don't think it is possible to run LIvecode Server directly under nginx. nginx does not support cgi and I believe that LiveCode Server supports only gci. (Though I would be happy to be proved wrong.) I also don't believe that LiveCode Server has fast-cgi support either which could be used in conjunction with nginx.

I run cgi scripts on a web system fronted by nginx by forwarding the cgi requests to a lightweight web server (Cheyenne in my case). This works well and is easy to set up and you don't need to worry about load balancing as you do with fast-cgi. Simple cgi requests with a couple of simple database calls take less than 600 milliseconds on the system, so performance hasn't been an issue.

[I'm afraid I haven't configured LiveCode to run in this way, my client doesn't use LiveCode yet.]
Last edited by Peter Wood on Tue Jul 01, 2014 3:20 pm, edited 1 time in total.

bangkok
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 937
Joined: Fri Aug 15, 2008 7:15 am

Re: Livecode Server with nginx

Post by bangkok » Tue Jul 01, 2014 7:07 am

Very interesting. Thanks for those informations. I didn't find any information about fast cgi support for LiveCode Server. I'm going to try.

Regarding your scheme (nginx - > Cheyenne) could you tell us why you did that, instead of using a classic Apache solution for instance ?

FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 9824
Joined: Sat Apr 08, 2006 7:05 am
Location: Los Angeles
Contact:

Re: Livecode Server with nginx

Post by FourthWorld » Tue Jul 01, 2014 7:25 am

bangkok wrote:Very interesting. Thanks for those informations. I didn't find any information about fast cgi support for LiveCode Server. I'm going to try.
Fast CGI is normally dependent on threading. In a single-thread language like LiveCode you would likely find it frustrating, and almost certainly challenging in terms of system load.

What is it about Nginx that makes it so compelling for your project? I wonder if there might be other means of getting what you're after.
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn

bangkok
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 937
Joined: Fri Aug 15, 2008 7:15 am

Re: Livecode Server with nginx

Post by bangkok » Tue Jul 01, 2014 9:02 am

FourthWorld wrote: What is it about Nginx that makes it so compelling for your project? I wonder if there might be other means of getting what you're after.
I was just curious. Nginx seems to be efficient, with low memory requirements, so I just wanted to experiment with LiveCode Server. :)

Peter Wood's scheme is intriguing though.

Peter Wood
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 92
Joined: Mon Jul 06, 2009 4:53 am
Location: Bamboo River

Re: Livecode Server with nginx

Post by Peter Wood » Tue Jul 01, 2014 3:11 pm

bangkok wrote:Regarding your scheme (nginx - > Cheyenne) could you tell us why you did that, instead of using a classic Apache solution for instance ?
Apache is very big (especially in terms of memory usage). My client prefers taking a lightweight approach (me too). I believe that nginx is faster at serving static resources (html, images, javascript) than Apache and it certainly consumes less memory and resources. Cheyenne is a lightweight server written in Rebol. As our CGIs are also written in Rebol and it has some features specific to Rebol, it was the best choice for us.
Last edited by Peter Wood on Tue Jul 01, 2014 11:59 pm, edited 1 time in total.

Peter Wood
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 92
Joined: Mon Jul 06, 2009 4:53 am
Location: Bamboo River

Re: Livecode Server with nginx

Post by Peter Wood » Tue Jul 01, 2014 3:18 pm

FourthWorld wrote: Fast CGI is normally dependent on threading. In a single-thread language like LiveCode you would likely find it frustrating, and almost certainly challenging in terms of system load.

What is it about Nginx that makes it so compelling for your project? I wonder if there might be other means of getting what you're after.
You can overcome the single-threaded issue to a great extent as nginx will forward requests to a range of ports. (Not true load balancing, it just loops through the list of ports). You still are left with working out how many instances of LiveCode Server to run and monitoring them. (And that is if LiveCode Server supports the Fast CGI protocol.)

Peter
Last edited by Peter Wood on Wed Jul 02, 2014 12:00 am, edited 1 time in total.

FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 9824
Joined: Sat Apr 08, 2006 7:05 am
Location: Los Angeles
Contact:

Re: Livecode Server with nginx

Post by FourthWorld » Tue Jul 01, 2014 3:24 pm

bangkok wrote:
FourthWorld wrote: What is it about Nginx that makes it so compelling for your project? I wonder if there might be other means of getting what you're after.
I was just curious. Nginx seems to be efficient, with low memory requirements, so I just wanted to experiment with LiveCode Server. :)
If you want really lean (though maybe more in features than system resources <g>) you could consider a server made entirely in LiveCode, like mchttpd:
http://fourthworld.net/lc/mchttpd-4W.zip
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn

bangkok
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 937
Joined: Fri Aug 15, 2008 7:15 am

Re: Livecode Server with nginx

Post by bangkok » Thu Jul 03, 2014 4:39 pm

FourthWorld wrote: If you want really lean (though maybe more in features than system resources <g>) you could consider a server made entirely in LiveCode, like mchttpd:
http://fourthworld.net/lc/mchttpd-4W.zip
Metacard... Many souvenirs. I've tried your stack with a LiveCode 5.5, it works ! :D

Pyrros
Posts: 9
Joined: Sun Apr 20, 2014 8:26 pm

Re: Livecode Server with nginx

Post by Pyrros » Fri Jul 04, 2014 7:31 pm

You could look at setting up Nginx with something like Thttpd. Nginx does not support CGI itself - it has to pass if off to a third party server.

That said, there is probably not going to be much difference in speed between Nginx and Apache as LiveCode is going parse scripts as pretty much the same speed regardless of the server used. Although Nginx is probably going to be more resource friendly.

If you are just wanting to experiement I would say go with Apache - its pretty simple to setup and seems to run pretty well - even on a small VPS and you can always change the hosting server at a later stage. Apache is probably also better documented in case you get stuck. It does seem to get a bit of bad reputation when it comes to load handling etc - but from my experience you do need quiet a load on the server before it acutally becomes a problem.

Cherokee is also an interesting looking alternative to Apache / Nginx and seems to be pretty good on the security side of things.

Post Reply

Return to “CGIs and the Server”