nginx + php + Solaris 10

I wanted to set up a development server to test more intensive PHP applications, and also a sandbox so I opted to get a typical web server stack on Solaris.

First thing's first: grab nginx from  Cool Stack page. There's some great packages there, like Apache, PHP and MySQL all in one. I decided to go with nginx for something light and something new. 

The binary for nginx is  /opt/coolstack/nginx/sbin/nginx so be sure to set your configuration in /opt/coolstack/nginx/conf/nginx.conf (pretty straight forward). Be sure to enable the FastCGI section in the config file!

Next thing is PHP. Pretty standard here. Get the source from php.net, configure and install. I ran ./configure with --prefix=/usr/local/php5 --enable-fastcg=/usr/local --enable-force-cgi-redirect --enable-cli --enable-zip --with-layout=GNU --with-regex=php --with-zlib=/usr/local --with-curl=/usr/local --enable-exif --with-gd 

Once that's done, set up your php.ini in /usr/local/php5/etc And of course, add cgi.fix_pathinfo = 1 to the end of the file. Now, for everything to piece together, you'll need FastCGI to parse PHP with nginx (as far as I know). Grab FastCGI from here and the standard compile commands.

Now, nginx was running but I couldn't get it to parse PHP. nginx was listening for port 9000 for FastCGI but it wasn't there. After a bit of Googling I found spawn-cgi, as it comes with lighttpd by default. Anyway, get spawn-cgi and install.

Finally, spawn FastCGI with:
/usr/local/bin/spawn-fcgi -a 127.0.0.1 -p 9000 -u www-data -f /usr/local/php5/bin/php-cgi


(You'll have to create user www-data if it doesn't exist).

And that's about it. I now have Proftpd on there, and it's running quite smoothly indeed. Any comments or ideas are welcome.