yum nginx , 安装越快越好~~这样做运维才爽嘛

利用CentOS Linux系统自带的yum命令安装、升级所需的程序库

1. LANG=C
2. yum -y install gcc gcc-c++ autoconf libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel libxml2 libxml2-devel zlib zlib-devel glibc glibc-devel glib2 glib2-devel bzip2 bzip2-devel ncurses ncurses-devel curl curl-devel e2fsprogs e2fsprogs-devel krb5 krb5-devel libidn libidn-devel openssl openssl-devel openldap openldap-devel nss_ldap openldap-clients openldap-servers

四、安装php和mysql

1. yum -y install php mysql mysql-server mysql-devel php-mysql php-cgi php-mbstring php-gd php-fastcgi

五、安装nginx
由于centos没有默认的nginx软件包,需要启用REHL的附件包

1. rpm -Uvh http://download.fedora.redhat.com/pub/epel/5/i386/epel-release-5-4.noarch.rpm
2. yum -y install nginx

设置开机启动

1. chkconfig nginx on

六、安装spawn-fcgi来运行php-cgi

1. yum install spawn-fcgi

七、下载spawn-fcgi 的启动脚本

1. wget http://bash.cyberciti.biz/dl/419.sh.zip
2. unzip 419.sh.zip
3. mv 419.sh /etc/init.d/php_cgi
4. chmod +x /etc/init.d/php_cgi

启动php_cgi

1. /etc/init.d/php_cgi start

查看进程

1. netstat -tulpn | grep :9000

若出现如下代表一切正常

1. tcp 0 0 127.0.0.1:9000 0.0.0.0:* LISTEN 4352/php-cgi

八、配置nginx(详细配置见nginx.conf详细说明)

1. location ~ \.php$ {
2. root html;
3. fastcgi_pass 127.0.0.1:9000;
4. fastcgi_index index.php;
5. fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
6. include fastcgi_params;
7. }

你可能感兴趣的:(PHP,mysql,nginx,centos,cgi)