yum install nginx yum -y install mysql mysql-server yum -y install php php-cgi php-mysql php-mbstring php-gd php-fastcgi yum -y install perl-DBI perl-DBD-MySQL
yum -y install spawn-fcgi
/etc/sysconfig/spawn-fcgi
移除SOCKET與OPTIONS註釋, apache改為nginx
# cat /etc/sysconfig/spawn-fcgi # You must set some working options before the "spawn-fcgi" service will work. # If SOCKET points to a file, then this file is cleaned up by the init script. # # See spawn-fcgi(1) for all possible options. # # Example : SOCKET=/var/run/php-fcgi.sock OPTIONS="-u apache -g apache -s $SOCKET -S -M 0600 -C 32 -F 1 -P /var/run/spawn-fcgi.pid -- /usr/bin/php-cgi"
chkconfig spawn-fcgi on
starting spawn-fcgi
/etc/init.d/spawn-fcgi start
check port
# netstat -nl Active Internet connections (only servers) Proto Recv-Q Send-Q Local Address Foreign Address State tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN tcp 0 0 :::22 :::* LISTEN Active UNIX domain sockets (only servers) Proto RefCnt Flags Type State I-Node Path unix 2 [ ACC ] STREAM LISTENING 25282 /var/run/php-fcgi.sock unix 2 [ ACC ] STREAM LISTENING 8227 @/com/ubuntu/upstart
Unix domain socket
location ~ \.php$ { fastcgi_pass unix:/var/run/php-fcgi.sock; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME /var/www/nginx-default$fastcgi_script_name; include fastcgi_params; }
TCP/IP
/usr/bin/spawn-fcgi -a 127.0.0.1 -p 9000 -u nginx -g nginx -d /www -C 32 -F 1 -P /var/run/spawn-fcgi.pid -f /usr/bin/php-cgi
location ~ \.php$ { fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME /var/www/nginx-default$fastcgi_script_name; include fastcgi_params; }
# netstat -tulpn | grep :9000 tcp 0 0 127.0.0.1:9000 0.0.0.0:* LISTEN 26877/php-cgi
chkconfig nginx on
check config
nginx -t
rpm -Uvh http://download.fedora.redhat.com/pub/epel/6/x86_64/epel-release-6-5.noarch.rpm yum install nginx -y
chkconfig nginx on
check config
nginx -t
其他 php-fpm YUM源
rpm --import http://rpms.famillecollet.com/RPM-GPG-KEY-remi rpm -ivh http://rpms.famillecollet.com/enterprise/remi-release-6.rpm
# rpm -Uvh http://centos.alt.ru/repository/centos/6/i386/centalt-release-6-1.noarch.rpm # yum update