Page 1 of 1
Livecode Server with nginx
Posted: Mon Jun 30, 2014 3:27 pm
by bangkok
Do you have any standard configuration file to run LiveCode Server on a nginx server ?
Re: Livecode Server with nginx
Posted: Tue Jul 01, 2014 2:42 am
by Peter Wood
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.]
Re: Livecode Server with nginx
Posted: Tue Jul 01, 2014 7:07 am
by bangkok
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 ?
Re: Livecode Server with nginx
Posted: Tue Jul 01, 2014 7:25 am
by FourthWorld
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.
Re: Livecode Server with nginx
Posted: Tue Jul 01, 2014 9:02 am
by bangkok
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.
Re: Livecode Server with nginx
Posted: Tue Jul 01, 2014 3:11 pm
by Peter Wood
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.
Re: Livecode Server with nginx
Posted: Tue Jul 01, 2014 3:18 pm
by Peter Wood
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
Re: Livecode Server with nginx
Posted: Tue Jul 01, 2014 3:24 pm
by FourthWorld
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
Re: Livecode Server with nginx
Posted: Thu Jul 03, 2014 4:39 pm
by bangkok
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 !

Re: Livecode Server with nginx
Posted: Fri Jul 04, 2014 7:31 pm
by Pyrros
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.