On Mon, Oct 12, 2009 at 10:03 PM, Fabio Mascarenhas <mascaren...@acm.org> wrote: > Hi Bertrand, > > From what I have seen of spawn-fcgi you just have to pass the path to > wsapi.fcgi to it, after the --, like so > > /usr/bin/spawn-fcgi -s /var/run/lighttpd/yourphpsocketname.sock -u > fastcgi-user -U webserver-user -- /usr/local/bin/wsapi.fcgi > > Of course you can also pass the main script of your web application > directly (if it has #!/usr/bin/env wsapi.fcgi on the first line and is > executable), but then this socket will only service a single WSAPI > app. Using wsapi.fcgi lets a single FastCGI process multiplex several > WSAPI applications. > > Please report your findings if you do try using it. I have tested > wsapi.fcgi with Lighty on Unices, but never with spawn-fcgi as > intermediary (I have never even heard about it until today).
Looks like we posted at the same time. Here is my setup so far (it might change in the future) : - I use Nginx as a webserver, it is configured this way for Lua fastcgi: location ~ ^(.+\.lua)(.*)$ { fastcgi_pass 127.0.0.1:9100; fastcgi_index index.lua; fastcgi_split_path_info ^(.+\.lua)(.*)$; fastcgi_param PATH_INFO $fastcgi_path_info; fastcgi_param PATH_TRANSLATED $document_root$fastcgi_path_info; include fastcgi_params; } Here is my fastcgi_params include file (it is the same as with PHP at the moment): fastcgi_param QUERY_STRING $query_string; fastcgi_param REQUEST_METHOD $request_method; fastcgi_param CONTENT_TYPE $content_type; fastcgi_param CONTENT_LENGTH $content_length; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; fastcgi_param SCRIPT_NAME $fastcgi_script_name; fastcgi_param REQUEST_URI $request_uri; fastcgi_param DOCUMENT_URI $document_uri; fastcgi_param DOCUMENT_ROOT $document_root; fastcgi_param SERVER_PROTOCOL $server_protocol; fastcgi_param GATEWAY_INTERFACE CGI/1.1; fastcgi_param SERVER_SOFTWARE nginx/$nginx_version; fastcgi_param REMOTE_ADDR $remote_addr; fastcgi_param REMOTE_PORT $remote_port; fastcgi_param SERVER_ADDR $server_addr; fastcgi_param SERVER_PORT $server_port; fastcgi_param SERVER_NAME $server_name; To get the PATH_INFO correctly in urls like /hello.lua/foo, you need the fastcgi_split_path_info directive. - My spawn-fcgi is set on port 9100, I have PHP on port 9000 already. It is started like this : sudo /usr/local/bin/spawn-fcgi -a 127.0.0.1 -p 9100 -u apache -g apache -f /usr/local/bin/wsapi.fcgi -P /var/run/fastcgi-lua.pid I use the default wsapi.fcgi but I had to redefine package.path and package.cpath for it to find Luarocks and friends. As an hello.lua script, I used : module(..., package.seeall) function run(wsapi_env) local headers = { ["Content-type"] = "text/html" } local function hello_text() coroutine.yield("<html><body>") coroutine.yield("<p>Hello Wsapi!</p>") coroutine.yield("<p>PATH_INFO: " .. wsapi_env.PATH_INFO .. "</p>") coroutine.yield("<p>SCRIPT_NAME: " .. wsapi_env.SCRIPT_NAME .. "</p>") coroutine.yield("</body></html>") end return 200, headers, coroutine.wrap(hello_text) end And it works :) If something gets wrong later, I will let you know. -- Bertrand Mansion Mamasam _______________________________________________ Kepler-Project mailing list Kepler-Project@lists.luaforge.net http://lists.luaforge.net/cgi-bin/mailman/listinfo/kepler-project http://www.keplerproject.org/