CentOS 5.3 + Nginx 0.7.x+ PHP 5.2.x+ MySQL 5.1.x服务器环境架
一、服务器软件环境信息
1.系统环境
CentOS 5.3 i386/x86_64
Nginx 0.7.63
PHP 5.2.10,PHP 5.2.10 -fpm 0.5.13.diff
ZendOptimizer-3.3.3-linux-i386/x86_64
MySql-5.1.39-linux-i386/x86_64
2.系统约定
软件源代码包存放位置 /usr/local/src
源码包编译安装位置(prefix) /usr/local/software_xxx
脚本以及维护程序存放位置 /usr/local/sbin
MySQL 数据库位置 /var/lib/mysql(可按情况设置)
网站根目录 /home/wwwroot(可按情况设置)
虚拟主机日志根目录 /home/wwwroot/logs(可按情况设置)
运行账户 www:www
3.系统初始化设置
a.关掉selinux
# vi /etc/selinux/config
# This file controls the state of SELinux on the system.
# SELINUX= can take one of these three values:
# enforcing – SELinux security policy is enforced.
# permissive – SELinux prints warnings instead of enforcing.
# disabled – SELinux is fully disabled.
SELINUX=enforcing (修改成disabled)
# SELINUXTYPE= type of policy in use. Possible values are:
# targeted – Only targeted network daemons are protected.
# strict – Full SELinux protection
SELINUXTYPE=targeted
b.关掉系统防火墙
永久性生效,重启后不会复原
# chkconfig iptables on (开启)
# chkconfig iptables off (关闭)
即时生效,重启后复原
# service iptables start (开启)
# service iptables stop (关闭)
c.更改系统启动方式:启动时进入字符终端模式
# vi /etc/inittab
··· ···
# Default runlevel. The runlevels used by RHS are:
# 0 – halt (Do NOT set initdefault to this)
# 1 – Single user mode
# 2 – Multiuser, without NFS (The same as 3, if you do not have networking)
# 3 – Full multiuser mode
# 4 – unused
# 5 – X11
# 6 – reboot (Do NOT set initdefault to this)
#
id:5:initdefault: (修改成:id:3:initdefault:)
··· ··
说明:
0:停机(记住不要把initdefault 设置为0,因为这样会使Linux无法启动 )
1:单用户模式,就像Win9X下的安全模式。
2:多用户,但是没有 NFS 。
3:完全多用户模式,标准的运行级。
4:一般不用,在一些特殊情况下可以用它来做一些事情。
5:X11,即进到 X-Window 系统。
6:重新启动 (记住不要把initdefault 设置为6,因为这样会使Linux不断地重新启动)。
e.更换yum国内源
# uname -a
Linux localhost.localdomain 2.6.18-128.el5PAE #1 SMP Wed Jan 21 11:19:46 EST 2009 i686 i686 i386 GNU/Linux
# cd /etc/yum.repos.d
# mv CentOS-Base.repo CentOS-Base.repo.save
# wget http://centos.ustc.edu.cn/CentOS-Base.repo.5
# mv CentOS-Base.repo.5 CentOS-Base.repo
# yum clean all
f.使用 yum 对系统进行更新并且安装必要软件包
g.重启服务器
# yum update -y
# yum -y install make openssl openssl-devel pcre pcre-devel libpng libpng-devel libjpeg-6b libjpeg-devel-6b freetype freetype-devel gd gd-devel zlib zlib-devel gcc gcc-c++ libXpm libXpm-devel ncurses ncurses-devel libmcrypt libmcrypt-devel libxml2 libxml2-devel imake autoconf automake screen sysstat compat-libstdc++-33 curl curl-devel
二、需要准备的软件源码
1.准备软件
新建一个down.txt的文本,并上传至/usr/local/src目录下,工具系统位数下载对应的MySql和ZendOptimizer内容如下:
# init 6 或者
# reboot
http://sysoev.ru/nginx/nginx-0.7.63.tar.gz
http://download.scientificlinux.net/nginx
http://download.scientificlinux.net/php-fpm.conf
http://download.scientificlinux.net/nginx.conf
http://download.scientificlinux.net/fcgi.conf
http://download.scientificlinux.net/php-5.2.10.tar.gz
http://download.scientificlinux.net/php-5.2.10-fpm-0.5.13.diff.gz
http://download.scientificlinux.net/ZendOptimizer-3.3.3-linux-glibc23-i386.tar.gz
http://download.scientificlinux.net/ZendOptimizer-3.3.3-linux-glibc23-x86_64.tar.gz
http://download.scientificlinux.net/mysql-5.1.39-linux-i686-glibc23.tar.gz
http://download.scientificlinux.net/mysql-5.1.39-linux-x86_64-glibc23.tar.gz
2.在终端使用wget下载软件:
# cd /usr/local/src
# wget -i down.txt