Re: Nginx + FastCGI + PHP5 on FreeBSD 6.2
- From: Volodymyr Kostyrko <c.kworr@xxxxxxxxx>
- Date: Fri, 07 Sep 2007 00:20:40 +0300
Peter Pluta wrote:
If anyone has a better method of getting it to work please do share it. I'd
like to get it to work and possibly write a small guide aim'd at FreeBSD
users.
nginx.conf snippet:
server {
listen *:80;
server_name ...;
root ...;
access_log /var/log/nginx/....access.log;
index index.php;
location ~ .*\.php$ {
include /usr/local/etc/nginx/fastcgi_params;
fastcgi_pass unix:/tmp/.fastcgi.www/socket;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME ...$fastcgi_script_name;
}
}
/usr/local/etc/rc.d/phpFcgid script:
#!/bin/sh
# PROVIDE: phpFcgid
# REQUIRE: LOGIN
# KEYWORD: shutdown
. /etc/rc.subr
name="phpFcgid"
rcvar=`set_rcvar`
load_rc_config $name
: ${phpFcgid_enable="NO"}
: ${phpFcgid_users="www"}
: ${phpFcgid_children="2"}
start_cmd=phpFcgid_start
stop_cmd=phpFcgid_stop
phpFcgid_start() {
echo "Starting $name."
export PHP_FCGI_CHILDREN=${phpFcgid_chidlren}
for user in ${phpFcgid_users}; do
socketdir="/tmp/.fastcgi.${user}"
mkdir -p ${socketdir}
chown ${user}:www ${socketdir}
chmod 0750 ${socketdir}
su -m ${user} -c "/usr/local/bin/php-cgi -b ${socketdir}/socket&"
done
}
phpFcgid_stop() {
echo "Stopping $name."
pids=`pgrep php-cgi`
pkill php-cgi
wait_for_pids $pids
}
run_rc_command "$1"
Also put this to your /etc/rc.conf file:
phpFcgid_enable='yes'
--
Sphinx of black quartz judge my vow.
_______________________________________________
freebsd-questions@xxxxxxxxxxx mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to "freebsd-questions-unsubscribe@xxxxxxxxxxx"
- References:
- Nginx + FastCGI + PHP5 on FreeBSD 6.2
- From: Peter Pluta
- Nginx + FastCGI + PHP5 on FreeBSD 6.2
- Prev by Date: Re: 6.2 Hangs Probing Floppy During Boot
- Next by Date: Re: FreeMAT fails to compile
- Previous by thread: Nginx + FastCGI + PHP5 on FreeBSD 6.2
- Next by thread: Re: Nginx + FastCGI + PHP5 on FreeBSD 6.2
- Index(es):
Relevant Pages
|