By prashant on Apr 29, 2009
Here's an SMF manifest for Nginx. You'll need to tweak it for your location of Nginx. You can create an nginx user and group to run the web server as(highly recommended), or tweak my script to run as root(please don't do this).
- Download the SMF from here
- groupadd nginx
- useradd -d /export/home/nginx -g nginx nginx
- change all occurrances of "/usr/nginx/sbin/nginx" to point to where ever your nginx is installed.
- You may remove the -c option in the nginx invocation if you do not want to place your nginx config file in that directory(or just want to use the default one).
- next, import the SMF script. svccfg import nginx.smf
- run svcs -vx to make sure everything went well. It should have, if you followed all the steps above.( else you'll be pointed to a log file for further debugging )
- You are set.
- Optional: add service dependendies on the mysql and thin/mongrel services on your system since nginx probably won't be of much use if you don't have those running.