lc server on Mountain Lion server

Are you using LiveCode to create server scripts or CGIs?

Moderators: Klaus, FourthWorld, heatherlaine, kevinmiller, robinmiller

Post Reply
sturgis
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 1682
Joined: Sat Feb 28, 2009 11:49 pm

lc server on Mountain Lion server

Post by sturgis » Tue Aug 14, 2012 12:49 am

Has anyone set up lc server on mountain lion server yet?
I guess I'm hoping for a few pointers to save me digging time. (it is already apparent that /etc/apache2 has NOTHING to do with setting things up with ML server, have found conf files elsewhere and will start exploring)

I may for the first time, resort to using .htaccess files to set things up, which brings me to the next (mostly unrelated) question.

When a new 'site' is set up in the server app, a set of default files are copied into the newly created site folder. Does anyone know where the skeleton directory is that is used for the basis, so that I can tweak the contents?

Having asked my questions, does anyone want to speak on likes/dislikes/quibbles with lion server and ML server? (So far i'm figuring things out ok, but not sure I like the server app, especially since i'm already going to have to mess with the conf files directly. And then worry that any update might wipe out my changes!)

sturgis
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 1682
Joined: Sat Feb 28, 2009 11:49 pm

Re: lc server on Mountain Lion server

Post by sturgis » Tue Aug 14, 2012 1:52 am

Found it. YAY!

For those if you about to set up lc server on mountain lion, if you want to do it for all sites here is a quick (very quick) run-through.
( all commands will need to be executed with high level privileges, you can either use sudo with every command, or if you're brave and very careful you can sudo su and do them all with root privileges )

start terminal

cd /Library/Server/Web/Config/apache2
with root privileges:
edit the file httpd_server_app.conf (I used vi cause I know it, but emacs or any straight text editor should work, including textEdit I believe, but must start it with admin privelages)

do a search for AddHandler (in vi, hit slash key then type AddHandler and hit enter)

it should jump (hopefully, if not search again) to a location that shows 'AddHandler cgi-script .cgi .pl .rb .py' -- these are the pre-setup handlers for perl ruby and python

add a new line under the existing addHandler that contains

AddHandler lc-script .lc .rev
If you want other extensions to be executed by livecode server add them to the list seperted by spaces

add another line
Action lc-script /cgi-bin/livecode-server

Save the file.

Copy the livecode-server file and its 2 folders (drivers and externals) into /Library/Server/Web/Data/CGI-Executables (all of this will be on the server HD volume)
Confirm that the owner of the files is root. (including livecode-server, the 2 folders, and the files in the folders) The group should be wheel. (chgrp if necessary)
confirm that livecode-server has rwx permissions set with group and everyone set to rx (chmod 755 livecode-server)

Go in to the server app, choose web, and if the server was already running, shut it down. wait long enough to be sure it shut down, then start it up again.

Place a file named something.lc into /Library/Server/Web/Data/Sites/Default.
make sure there is a valid lc script in the file.
set the permissions of the file. (I believe 644 is fine the owner should be root, group wheel)

Check the file with your browser. If you placed it as described, and named ot something.lc you should be able to get to it with http://localhost/something.lc

Hope this helps someone.

EDIT: Forgot, in the web server configuration of the server app, you can add an index to the list of index files for index.lc so that if you hit a directory and don't supply a filename it will look for index.lc as one of the potential files to automagically open. (And you once you add it, you can drag it to the top of the list of indexes before clicking ok, so that it takes precedence over index.html default.html etc)

Yann
Posts: 32
Joined: Wed Oct 13, 2010 9:55 am

Re: lc server on Mountain Lion server

Post by Yann » Sun Oct 14, 2012 9:39 pm

sturgis wrote:Hope this helps someone.
It did help me a lot, thank you very much for your post ! :D

Post Reply

Return to “CGIs and the Server”