环境:Centos 5.4 nginx-0.7.62 mysql5.1.39 php5.2.11
目录
nginx-0.7.62+php5.2.11(fastcgi)+mysql-5.1.39安装文档
安装nginx
mysql安装
php安装
安装GD相关软件包
安装PHP相关软件包
创建php.ini文件
修改php.ini参数
配置php-fpm文件
启动FastCGI进程
php相关软件包下载地址:http://www.chinasa.net/uploads/php-soft.rar
nginx下载地址:http://www.nginx.org/en/download.html
mysql下载地址:http://www.mysql.com/downloads/mysql/
nginx下载地址:http://www.nginx.org/en/download.html
mysql下载地址:http://www.mysql.com/downloads/mysql/
安装nginx
nginx
需要安装pcre库
# tar -zxvf pcre-7.8.tar.gz
# cd pcre-7.8
# ./configure
# make && make install
nginx
安装
# tar zxvf nginx-0.7.62.tar.gz
# ./configure \
--prefix=/opt/nginx \
--with-http_stub_status_module
# make && make install
mysql安装
添加mysql组和mysql用户
# groupadd mysql
# useradd -g mysql mysql
编译与安装
# tar -zxvf mysql-5.1.39.tar.gz
# cd mysql-5.1.39
./configure \
--prefix=/opt/mysql \
--enable-assembler \
--with-plugins=innobase,partition,myisam \
--with-extra-charsets=none \
--enable-thread-safe-client \
--with-client-ldflags=-all-static \
--with-mysqld-ldflags=-all-static
# make && make install
mysql
目录权限设置
# mkdir /opt/mysql/var
# mkdir /var/run/mysqld
# chmod +w /opt/mysql/
# chown -R mysql:mysql /opt/mysql/
# chown -R mysql:mysql /var/run/mysqld
添加mysql配置文件
# cp /opt/mysql/share/mysql/my-innodb-heavy-4G.cnf /etc/my.cnf
以mysql用户初始化数据库表
# /opt/mysql/bin/mysql_install_db --basedir=/opt/mysql --user=mysql
添加mysql启动/停止脚本
# cp /soft/mysql-5.1.39/support-files/mysql.server.sh /etc/init.d/
# chmod 700 /etc/init.d/mysqld
# chkconfig --add mysqld
# chkconfig --level 345 mysqld on
也可以手动添加mysql自启动
# echo "/opt/mysql/bin/mysqld_safe --user=mysql &" >> /etc/rc.local
php安装
创建相应目录
# mkdir -p /opt/modules/jpeg7/man/man1
# mkdir /opt/modules/jpeg7/bin
# mkdir /opt/modules/jpeg7/lib
# mkdir /opt/modules/jpeg7/include
安装GD相关软件包
Libiconv安装
# tar zxvf libiconv-1.13.1.tar.gz
# cd libiconv-1.13.1/
# ./configure --prefix=/opt/modules/libiconv
# make && make install
Freetype安装
# cd freetype-2.3.10
# ./configure --prefix=/opt/modules/freetype
# make && make install
Libpng 安装
# tar zxvf libpng-1.2.40.tar.gz
# cd libpng-1.2.40
# cp scripts/makefile.std makefile
注:(64位系统下,需要修改makefile文件:找到CFLAGS=后加上-fPIC) 这里一定要修改,否则后面的php编译通不过
# make test && make install
jpegsrc.v7 安装
# tar zxvf jpegsrc.v7.tar.gz
# cd jpeg-7/
# ./configure --prefix=/opt/modules/jpeg7 \
--enable-shared \
--enable-static
# make && make install
libxml2-sources 安装
# tar zxvf libxml2-sources-2.6.30.tar.gz
# cd libxml2-2.6.30/
# ./configure --prefix=/opt/modules/libxml
# make && make install
安装GD
# tar zxvf gd-2.0.35.tar.gz
# cd gd-2.0.35
# ./configure --prefix=/opt/modules/gd \
--with-jpeg=/opt/modules/jpeg7 \
--with-png=/usr/local \
--with-zlib \
--with-freetype=/opt/modules/freetype
注:64位要添加此选项 --enable-m4_pattern_allow
# make && make install
注:
安装php5需要gd2的支持,但在安装过程中,执行编译的时候出现
aclocal:configure.ac:64: warning: macro `AM_ICONV
’ not found in library的错误,
搜索google得知安装gettext这个包就可以了。
#yum install gettext gettext-devel
再执行make编译就好了。