Chinaunix首页 | 论坛 | 博客
  • 博客访问: 113574
  • 博文数量: 26
  • 博客积分: 1726
  • 博客等级: 上尉
  • 技术积分: 435
  • 用 户 组: 普通用户
  • 注册时间: 2006-02-11 14:24
文章分类

全部博文(26)

文章存档

2013年(2)

2011年(2)

2010年(15)

2008年(7)

我的朋友

分类: LINUX

2010-12-06 11:39:26

一、更改yum源为网易的源加快速度
vi /etc/yum.repos.d/CentOS-Base.repo
更改内容如下

  1. # CentOS-Base.repo
  2. #
  3. # This file uses a new mirrorlist system developed by Lance Davis for CentOS.
  4. # The mirror system uses the connecting IP address of the client and the
  5. # update status of each mirror to pick mirrors that are updated to and
  6. # geographically close to the client. You should use this for CentOS updates
  7. # unless you are manually picking other mirrors.
  8. #
  9. # If the mirrorlist= does not work for you, as a fall back you can try the
  10. # remarked out baseurl= line instead.
  11. #
  12. #
  13. [base]
  14. name=CentOS-$releasever - Base
  15. #mirrorlist=
  16. #baseurl=
  17. baseurl=
  18. gpgcheck=1
  19. gpgkey=
  20. #released updates
  21. [updates]
  22. name=CentOS-$releasever - Updates
  23. #mirrorlist=
  24. #baseurl=
  25. baseurl=
  26. gpgcheck=1
  27. gpgkey=
  28. #packages used/produced in the build but not released
  29. [addons]
  30. name=CentOS-$releasever - Addons
  31. #mirrorlist=
  32. #baseurl=
  33. baseurl=
  34. gpgcheck=1
  35. gpgkey=
  36. #additional packages that may be useful
  37. [extras]
  38. name=CentOS-$releasever - Extras
  39. #mirrorlist=
  40. #baseurl=
  41. baseurl=
  42. gpgcheck=1
  43. gpgkey=
  44. #additional packages that extend functionality of existing packages
  45. [centosplus]
  46. name=CentOS-$releasever - Plus
  47. #mirrorlist=
  48. #baseurl=
  49. baseurl=
  50. gpgcheck=1
  51. enabled=0
  52. gpgkey=

二、update yum

  1. yum -y update

三、利用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
  2. yum -y install nginx

设置开机启动

  1. chkconfig nginx on

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

  1. yum install spawn-fcgi

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

  1. wget
  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 /usr/share/nginx/html$fastcgi_script_name;
  6. include fastcgi_params;
  7. }

九、查看phpinfo
编写脚本

  1. phpinfo();

十、安装phpmyadmin
修改/var/lib/php/session的权限和nginx和php_cgi一致

  1. chown -R /var/lib/php/session
阅读(1165) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~