<?xml version="1.0"?>
<?xml-stylesheet type="text/css" href="http://wiki.nginx.org/skins/common/feed.css?303"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
		<id>http://wiki.nginx.org/index.php?title=FreeBSDSpawnFCGIrc&amp;feed=atom&amp;action=history</id>
		<title>FreeBSDSpawnFCGIrc - Revision history</title>
		<link rel="self" type="application/atom+xml" href="http://wiki.nginx.org/index.php?title=FreeBSDSpawnFCGIrc&amp;feed=atom&amp;action=history"/>
		<link rel="alternate" type="text/html" href="http://wiki.nginx.org/index.php?title=FreeBSDSpawnFCGIrc&amp;action=history"/>
		<updated>2013-06-18T22:50:08Z</updated>
		<subtitle>Revision history for this page on the wiki</subtitle>
		<generator>MediaWiki 1.19.0</generator>

	<entry>
		<id>http://wiki.nginx.org/index.php?title=FreeBSDSpawnFCGIrc&amp;diff=447&amp;oldid=prev</id>
		<title>Kipz: minor upgrade to the script, enjoy</title>
		<link rel="alternate" type="text/html" href="http://wiki.nginx.org/index.php?title=FreeBSDSpawnFCGIrc&amp;diff=447&amp;oldid=prev"/>
				<updated>2010-09-03T23:31:41Z</updated>
		
		<summary type="html">&lt;p&gt;minor upgrade to the script, enjoy&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;''What is this:''&lt;br /&gt;
&lt;br /&gt;
A &amp;quot;one size fits all&amp;quot; script to interface with spawn-fcgi in a friendly way. It is provided with an example of how to launch PHP, but only needs quick modifying to work with anything that can run as a FastCGI process. Feel free to experiment - this also has been successfully tested with Python WSGI, CGILua, and the like for example.&lt;br /&gt;
&lt;br /&gt;
Note to PHP users on FreeBSD: PHP-FPM support is available from the configure screen - this will allow you to do fine tuning over the FastCGI processes. In my own opinion, you should be using PHP-FPM over this.&lt;br /&gt;
&lt;br /&gt;
Note to everyone else: I have recently switched this over to use UNIX sockets instead of TCP ports; if you want to use a TCP port instead, just type the port into SERVER_SOCKET, and then switch the -s switch to a -p switch in the fcgi_start function :)&lt;br /&gt;
&lt;br /&gt;
''File:''&lt;br /&gt;
&lt;br /&gt;
/usr/local/etc/rc.d/spawn-fcgi&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
''Usage:''&lt;br /&gt;
&lt;br /&gt;
/usr/local/etc/rc.d/spawn-fcgi [(re)start|status|stop]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
''Run this script on boot (add to /etc/rc.local):''&lt;br /&gt;
&lt;br /&gt;
/usr/local/etc/rc.d/spawn-fcgi start&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
''Script:''&lt;br /&gt;
&lt;br /&gt;
&amp;lt;geshi lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/sh&lt;br /&gt;
# Modified spawn-fcgi for rc.d (original: vivek@nixcraft.com)&lt;br /&gt;
NAME=php-cgi&lt;br /&gt;
SPAWNFCGI=/usr/local/bin/spawn-fcgi&lt;br /&gt;
FCGI_CHILDREN=3&lt;br /&gt;
PROCESS_NAME=lua&lt;br /&gt;
SERVER_SOCKET=/tmp/fcgi.socket&lt;br /&gt;
SERVER_PID=/tmp/fcgi.pid&lt;br /&gt;
SERVER_USER=www&lt;br /&gt;
SERVER_GROUP=www&lt;br /&gt;
FCGI_PROCESS=/usr/local/bin/php-cgi&lt;br /&gt;
SOCKSTAT=/usr/bin/sockstat&lt;br /&gt;
GREP=/usr/bin/grep&lt;br /&gt;
KILLALL=/usr/bin/killall&lt;br /&gt;
cmd=$1&lt;br /&gt;
fcgi_restart()&lt;br /&gt;
{&lt;br /&gt;
        fcgi_stop&lt;br /&gt;
        fcgi_start&lt;br /&gt;
}&lt;br /&gt;
fcgi_start()&lt;br /&gt;
{&lt;br /&gt;
        $SPAWNFCGI -s $SERVER_SOCKET -P $SERVER_PID -u $SERVER_USER -g $SERVER_GROUP -F $FCGI_CHILDREN -f $FCGI_PROCESS&lt;br /&gt;
}&lt;br /&gt;
fcgi_stop()&lt;br /&gt;
{&lt;br /&gt;
        $KILLALL $PROCESS_NAME&lt;br /&gt;
}&lt;br /&gt;
fcgi_status()&lt;br /&gt;
{&lt;br /&gt;
        $SOCKSTAT -u | $GREP -i $SERVER_SOCKET &amp;gt; /dev/null&lt;br /&gt;
        [ $? -eq 0  ] &amp;amp;&amp;amp; echo &amp;quot;$PROCESS_NAME is running&amp;quot; || echo &amp;quot;$PROCESS_NAME is not running!&amp;quot;&lt;br /&gt;
}&lt;br /&gt;
fcgi_help()&lt;br /&gt;
{&lt;br /&gt;
        echo &amp;quot;Usage: $0 {(re)start|status|stop}&amp;quot;&lt;br /&gt;
}&lt;br /&gt;
case ${cmd} in&lt;br /&gt;
[Rr][Ee][Ss][Tt][Aa][Rr][Tt]) fcgi_restart;;&lt;br /&gt;
[Ss][Tt][Aa][Rr][Tt]) fcgi_start;;&lt;br /&gt;
[Ss][Tt][Oo][Pp]) fcgi_stop;;&lt;br /&gt;
[Ss][Tt][Aa][Tt][Uu][Ss]) fcgi_status;;&lt;br /&gt;
*) fcgi_help;;&lt;br /&gt;
esac&lt;br /&gt;
&amp;lt;/geshi&amp;gt;&lt;/div&gt;</summary>
		<author><name>Kipz</name></author>	</entry>

	</feed>