引言:
操作系统:RHEL 6.1 32位
下载地址:请自行下载,这里提供一个下载地址,仅供参考
ed2k://|file|[红帽企业Linux.6.1].rhel-server-6.1-i386-dvd.iso|3066486784|492a4ccae7c2c52cca87196c72a4e24f|h=hzsovcxap52sc2y2wfapxrratgnbpn72|/
安装方式:采用最小化安装,在安装系统的时候选择最小安装模式,不含有任何可选安装包,最小化安装完成之后,系统占用800M左右磁盘空间。
备注:操作系统的安装,这里就不演示了,如果有疑问可以参考相关教程
安装前准备:
1、配置好IP、DNS、网关,确保使用远程连接工具能够连接服务器
系统运维 www.osyunwei.com 温馨提醒:qihang01原创内容©版权所有,转载请注明出处及原文链接
vi /etc/sysconfig/network-scripts/ifcfg-eth0 #添加以下配置信息(具体IP等信息改为你自己的)
ONBOOT=yes
IPADDR=192.168.1.2 #配置ip地址
NETMASK=255.255.255.0 #子网掩码
GATEWAY=192.168.1.1 #设置网关
DNS1=8.8.8.8
DNS2=8.8.4.4
service network restart #重启网络服务
2、关闭selinux
vi /etc/selinux/config 把SELINUX=enforcing SELINUXTYPE=targetede 注释掉,然后新加一行为:SELINUX=disabled
3、开启防火墙相应端口,apache需要开启80端口 MySQL需要开启3306端口
vi /etc/sysconfig/iptables
添加下面的内容
-A INPUT -m state --state NEW -m tcp -p tcp --dport 80 -j ACCEPT #(允许80端口通过防火墙)
-A INPUT -m state --state NEW -m tcp -p tcp --dport 3306 -j ACCEPT #(允许3306端口通过防火墙)
重启防火墙使配置生效
/etc/init.d/iptables restart
4 、系统约定
软件源代码包存放位置:/usr/local/src
源码包编译安装位置:/usr/local/软件名字
5、下载软件
(一)Nginx
http://nginx.org/download/nginx-1.0.9.tar.gz
(二)MySQL
http://downloads.mysql.com/archives/mysql-5.5/mysql-5.5.17.tar.gz
(三)PHP
http://cn2.php.net/distributions/php-5.3.8.tar.gz
(四)Zend Guard
http://downloads.zend.com/guard/5.5.0/ZendGuardLoader-php-5.3-linux-glibc23-i386.tar.gz
(五)libmcrypt
ftp://mcrypt.hellug.gr/pub/crypto/mcrypt/libmcrypt/libmcrypt-2.5.7.tar.gz
(六)cmake
http://www.cmake.org/files/v2.8/cmake-2.8.6.tar.gz
(七)pcre
ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.20.tar.gz
用WinSCP远程连接到服务器,把下载好的软件上传到服务器/usr/local/src下面。
6、下载编译工具(要编译安装软件,必须先安装编译工具)
打开RHEL 6.1安装光盘,在Packages文件夹下面,找到下面的安装包
kernel-headers-2.6.32-131.0.15.el6.i686.rpm
compat-glibc-headers-2.5-46.2.i686.rpm
compat-glibc-2.5-46.2.i686.rpm
compat-libstdc++-33-3.2.3-69.el6.i686.rpm
compat-libf2c-34-3.4.6-19.el6.i686.rpm
compat-libgcc-296-2.96-144.el6.i686.rpm
mpfr-2.4.1-6.el6.i686.rpm
cpp-4.4.5-6.el6.i686.rpm
glibc-headers-2.12-1.25.el6.i686.rpm
glibc-devel-2.12-1.25.el6.i686.rpm
libgomp-4.4.5-6.el6.i686.rpm
libstdc++-devel-4.4.5-6.el6.i686.rpm
ppl-0.10.2-11.el6.i686.rpm
cloog-ppl-0.15.7-1.2.el6.i686.rpm
gcc-4.4.5-6.el6.i686.rpm
compat-gcc-34-3.4.6-19.el6.i686.rpm
compat-gcc-34-c++-3.4.6-19.el6.i686.rpm
make-3.81-19.el6.i686.rpm
keyutils-libs-devel-1.4-1.el6.i686.rpm
libcom_err-devel-1.41.12-7.el6.i686.rpm
libsepol-devel-2.0.41-3.el6.i686.rpm
libselinux-devel-2.0.94-5.el6.i686.rpm
krb5-devel-1.9-9.el6.i686.rpm
zlib-devel-1.2.3-25.el6.i686.rpm
openssl-devel-1.0.0-10.el6.i686.rpm
libXpm-3.5.8-2.el6.i686.rpm
gd-2.0.35-10.el6.i686.rpm
freetype-2.3.11-6.el6_0.2.i686.rpm
libxml2-2.7.6-1.el6.i686.rpm
libxml2-devel-2.7.6-1.el6.i686.rpm
curl-7.19.7-26.el6.i686.rpm
libjpeg-devel-6b-46.el6.i686.rpm
libjpeg-6b-46.el6.i686.rpm
libjpeg-static-6b-46.el6.i686.rpm #需要从CentOS 6.0 rpm包中下载
libpng-1.2.44-1.el6.i686.rpm
libpng-devel-1.2.44-1.el6.i686.rpm
libpng-static-1.2.44-1.el6.i686.rpm #需要从CentOS 6.0 rpm包中下载
php-common-5.3.3-3.el6.i686.rpm
php-gd-5.3.3-3.el6.i686.rpm
gcc-c++-4.4.5-6.el6.i686.rpm
ncurses-devel-5.7-3.20090208.el6.i686.rpm
ncurses-term-5.7-3.20090208.el6.i686.rpm
ncurses-static-5.7-3.20090208.el6.i686.rpm #需要从CentOS 6.0 rpm包中下载
perl-Pod-Escapes-1.04-119.el6.i686.rpm
perl-libs-5.10.1-119.el6.i686.rpm
perl-version-0.77-119.el6.i686.rpm
perl-Module-Pluggable-3.90-119.el6.i686.rpm
perl-Pod-Simple-3.13-119.el6.i686.rpm
perl-5.10.1-119.el6.i686.rpm
autoconf213-2.13-20.1.el6.noarch.rpm #需要从CentOS 6.0 rpm包中下载
autoconf-2.63-5.1.el6.noarch.rpm
automake-1.11.1-1.2.el6.noarch.rpm
automake14-1.4p6-19.2.el6.noarch.rpm #需要从CentOS 6.0 rpm包中下载
automake16-1.6.3-18.el6.1.noarch.rpm #需要从CentOS 6.0 rpm包中下载
libtool-ltdl-2.2.6-15.5.el6.i686.rpm
libtool-ltdl-devel-2.2.6-15.5.el6.i686.rpm #需要从CentOS 6.0 rpm包中下载
libtool-2.2.6-15.5.el6.i686.rpm
patch-2.6-6.el6.i686.rpm
bison-2.4.1-5.el6.i686.rpm
注意:有7个rpm安装包rhel 6.1中没有,要从CentOS 6.0的 rpm包中下载
下载地址:http://mirror.centos.org/centos/6.0/os/i386/Packages/
把这些安装包用WinSCP远程连接工具上传到服务器的/usr/local/src下面,这里我们是把软件下载好之后,再通过远程连接工具上传到服务器上面的。因为最小化安装完系统之后是不带wget命令的,所以无法直接从服务器下载,当然,不建议直接在服务器上面下载软件。
到此,安装前准备工作完成。
=========================================================================
正式安装开始
以下是用putty工具远程登录到服务器,在终端命令行下面操作的
1、安装编译工具
cd /usr/local/src #进入软件包存放目录
按照以下顺序进行安装,特别注意:顺序一定不能错,否则安装失败
小技巧:可以把下面的所有行按顺序一次性复制到终端命令行,
系统会自动安装的,这样会节省很对时候,同时也避免操作错误!
rpm -ivh kernel-headers-2.6.32-131.0.15.el6.i686.rpm
rpm -ivh compat-glibc-headers-2.5-46.2.i686.rpm
rpm -ivh compat-glibc-2.5-46.2.i686.rpm
rpm -ivh compat-libstdc++-33-3.2.3-69.el6.i686.rpm
rpm -ivh compat-libf2c-34-3.4.6-19.el6.i686.rpm
rpm -ivh compat-libgcc-296-2.96-144.el6.i686.rpm
rpm -ivh mpfr-2.4.1-6.el6.i686.rpm
rpm -ivh cpp-4.4.5-6.el6.i686.rpm
rpm -ivh glibc-headers-2.12-1.25.el6.i686.rpm
rpm -ivh glibc-devel-2.12-1.25.el6.i686.rpm
rpm -ivh libgomp-4.4.5-6.el6.i686.rpm
rpm -ivh libstdc++-devel-4.4.5-6.el6.i686.rpm
rpm -ivh ppl-0.10.2-11.el6.i686.rpm
rpm -ivh cloog-ppl-0.15.7-1.2.el6.i686.rpm
rpm -ivh gcc-4.4.5-6.el6.i686.rpm
rpm -ivh compat-gcc-34-3.4.6-19.el6.i686.rpm
rpm -ivh compat-gcc-34-c++-3.4.6-19.el6.i686.rpm
rpm -ivh make-3.81-19.el6.i686.rpm
rpm -ivh keyutils-libs-devel-1.4-1.el6.i686.rpm
rpm -ivh libcom_err-devel-1.41.12-7.el6.i686.rpm
rpm -ivh libsepol-devel-2.0.41-3.el6.i686.rpm
rpm -ivh libselinux-devel-2.0.94-5.el6.i686.rpm
rpm -ivh krb5-devel-1.9-9.el6.i686.rpm
rpm -ivh zlib-devel-1.2.3-25.el6.i686.rpm
rpm -ivh openssl-devel-1.0.0-10.el6.i686.rpm
rpm -ivh libXpm-3.5.8-2.el6.i686.rpm
rpm -ivh gd-2.0.35-10.el6.i686.rpm
rpm -ivh freetype-2.3.11-6.el6_0.2.i686.rpm
rpm -ivh libxml2-2.7.6-1.el6.i686.rpm
rpm -ivh libxml2-devel-2.7.6-1.el6.i686.rpm
rpm -ivh curl-7.19.7-26.el6.i686.rpm
rpm -ivh libjpeg-devel-6b-46.el6.i686.rpm
rpm -ivh libjpeg-6b-46.el6.i686.rpm
rpm -ivh libjpeg-static-6b-46.el6.i686.rpm
rpm -ivh libpng-1.2.44-1.el6.i686.rpm
rpm -ivh libpng-devel-1.2.44-1.el6.i686.rpm
rpm -ivh libpng-static-1.2.44-1.el6.i686.rpm
rpm -ivh php-common-5.3.3-3.el6.i686.rpm
rpm -ivh php-gd-5.3.3-3.el6.i686.rpm
rpm -ivh gcc-c++-4.4.5-6.el6.i686.rpm
rpm -ivh ncurses-devel-5.7-3.20090208.el6.i686.rpm
rpm -ivh ncurses-term-5.7-3.20090208.el6.i686.rpm
rpm -ivh ncurses-static-5.7-3.20090208.el6.i686.rpm
rpm -ivh --nodeps perl-Pod-Escapes-1.04-119.el6.i686.rpm
rpm -ivh --nodeps perl-libs-5.10.1-119.el6.i686.rpm
rpm -ivh --nodeps perl-version-0.77-119.el6.i686.rpm
rpm -ivh --nodeps perl-Module-Pluggable-3.90-119.el6.i686.rpm
rpm -ivh --nodeps perl-Pod-Simple-3.13-119.el6.i686.rpm
rpm -ivh --nodeps perl-5.10.1-119.el6.i686.rpm
rpm -ivh autoconf213-2.13-20.1.el6.noarch.rpm
rpm -ivh autoconf-2.63-5.1.el6.noarch.rpm
rpm -ivh automake-1.11.1-1.2.el6.noarch.rpm
rpm -ivh automake14-1.4p6-19.2.el6.noarch.rpm
rpm -ivh automake16-1.6.3-18.el6.1.noarch.rpm
rpm -ivh libtool-ltdl-2.2.6-15.5.el6.i686.rpm
rpm -ivh libtool-ltdl-devel-2.2.6-15.5.el6.i686.rpm
rpm -ivh libtool-2.2.6-15.5.el6.i686.rpm
rpm -ivh patch-2.6-6.el6.i686.rpm
rpm -ivh bison-2.4.1-5.el6.i686.rpm
系统运维 www.osyunwei.com 温馨提醒:qihang01原创内容©版权所有,转载请注明出处及原文链接
2、安装cmake #用来编译MySQL
cd /usr/local/src
tar zxvf cmake-2.8.6.tar.gz
cd cmake-2.8.6
./configure
make #编译
make install #安装
3、安装libmcrypt
cd /usr/local/src
tar zxvf libmcrypt-2.5.7.tar.gz #解压
cd libmcrypt-2.5.7 #进入目录
./configure
make #编译
make install #安装
4、安装mysql
groupadd mysql #添加mysql组
useradd -g mysql mysql -s /bin/false #创建用户mysql并加入到mysql组,不允许mysql用户直接登录系统
mkdir -p /data/mysql #创建MySQL数据库存放目录
chown -R mysql:mysql /data/mysql #设置MySQL数据库目录权限
cd /usr/local/src
tar zxvf mysql-5.5.17.tar.gz #解压
cd mysql-5.5.17
cmake . -DCMAKE_INSTALL_PREFIX=/usr/local/mysql -DMYSQL_DATADIR=/data/mysql -DSYSCONFDIR=/etc/
make #编译
make install #安装
cd /usr/local/mysql
cp ./support-files/my-huge.cnf /etc/my.cnf #拷贝配置文件(注意:/etc目录下面默认有一个my.cnf,直接覆盖即可)
vi /etc/my.cnf #编辑配置文件,在 [mysqld] 部分增加
datadir = /data/mysql #添加MySQL数据库路径
./scripts/mysql_install_db --user=mysql #生成mysql系统数据库
cp ./support-files/mysql.server /etc/rc.d/init.d/mysqld #把Mysql加入系统启动
chmod 755 /etc/init.d/mysqld #增加执行权限
chkconfig mysqld on #加入开机启动
vi /etc/rc.d/init.d/mysqld #编辑
basedir = /usr/local/mysql #MySQL程序安装路径
datadir = /data/mysql #MySQl数据库存放目录
service mysqld start #启动
vi /etc/profile #把mysql服务加入系统环境变量:在最后添加下面这一行
export PATH=$PATH:/usr/local/mysql/bin
下面这两行把myslq的库文件链接到系统默认的位置,这样你在编译类似PHP等软件时可以不用指定mysql的库文件地址。
ln -s /usr/local/mysql/lib/mysql /usr/lib/mysql
ln -s /usr/local/mysql/include/mysql /usr/include/mysql
shutdown -r now #需要重启系统,等待系统重新启动之后继续在终端命令行下面操作
mysql_secure_installation #设置Mysql密码
根据提示按Y 回车输入2次密码
或者直接修改密码/usr/local/mysql/bin/mysqladmin -u root -p password "123456" #修改密码
service mysqld restart #重启
到此,mysql安装完成!
5、安装Nginx
(一)、安装pcre #支持Nginx伪静态
cd /usr/local/src
tar zxvf pcre-8.20.tar.gz
mkdir /usr/local/pcre #创建安装目录
cd pcre-8.20
./configure --prefix=/usr/local/pcre #配置
make
make install
(二)安装 nginx
cd /usr/local/src
tar zxvf nginx-1.0.9.tar.gz
cd nginx-1.0.9
./configure --prefix=/usr/local/nginx --with-http_stub_status_module --with-openssl=/usr/ --with-pcre=/usr/local/src/pcre-8.20
注意:--with-pcre=/usr/local/src/pcre-8.13指向的是源码包解压的路径,而不是安装的路径,否则会报错
make
make install
启动 /usr/local/nginx/sbin/nginx
chown nobody.nobody -R /usr/local/nginx/html
chmod 700 -R /usr/local/nginx/html
设置nginx开启启动
vi /etc/rc.d/init.d/nginx #编辑启动文件添加下面内容
=======================================================
#!/bin/bash
# nginx Startup script for the Nginx HTTP Server
# it is v.0.0.2 version.
# chkconfig: - 85 15
# description: Nginx is a high-performance web and proxy server.
# It has a lot of features, but it's not for everyone.
# processname: nginx
# pidfile: /var/run/nginx.pid
# config: /usr/local/nginx/conf/nginx.conf
nginxd=/usr/local/nginx/sbin/nginx
nginx_config=/usr/local/nginx/conf/nginx.conf
nginx_pid=/usr/local/nginx/logs/nginx.pid
RETVAL=0
prog="nginx"
# Source function library.
. /etc/rc.d/init.d/functions
# Source networking configuration.
. /etc/sysconfig/network
# Check that networking is up.
[ ${NETWORKING} = "no" ] && exit 0
[ -x $nginxd ] || exit 0
# Start nginx daemons functions.
start() {
if [ -e $nginx_pid ];then
echo "nginx already running...."
exit 1
fi
echo -n $"Starting $prog: "
daemon $nginxd -c ${nginx_config}
RETVAL=$?
echo
[ $RETVAL = 0 ] && touch /var/lock/subsys/nginx
return $RETVAL
}
# Stop nginx daemons functions.
stop() {
echo -n $"Stopping $prog: "
killproc $nginxd
RETVAL=$?
echo
[ $RETVAL = 0 ] && rm -f /var/lock/subsys/nginx /usr/local/nginx/logs/nginx.pid
}
reload() {
echo -n $"Reloading $prog: "
#kill -HUP `cat ${nginx_pid}`
killproc $nginxd -HUP
RETVAL=$?
echo
}
# See how we were called.
case "$1" in
start)
start
;;
stop)
stop
;;
reload)
reload
;;
restart)
stop
start
;;
status)
status $prog
RETVAL=$?
;;
*)
echo $"Usage: $prog {start|stop|restart|reload|status|help}"
exit 1
esac
exit $RETVAL
=======================================================
:wq!保存退出
chmod 775 /etc/rc.d/init.d/nginx #赋予文件执行权限
chkconfig nginx on #设置开机启动
/etc/rc.d/init.d/nginx restart
service nginx restart
系统运维 www.osyunwei.com 温馨提醒:qihang01原创内容©版权所有,转载请注明出处及原文链接
=======================================================
6、安装php
cd /usr/local/src
tar -zvxf php-5.3.8.tar.gz
cd php-5.3.8
mkdir -p /usr/local/php5 #建立php安装目录
./configure --prefix=/usr/local/php5 --with-config-file-path=/usr/local/php5/etc --with-mysql=/usr/local/mysql --with-mysqli=/usr/local/mysql/bin/mysql_config --with-mysql-sock=/tmp/mysql.sock --with-gd --with-iconv --with-freetype --with-jpeg --with-png --with-zlib --with-libxml --enable-xml --enable-discard-path --enable-magic-quotes --enable-safe-mode --enable-bcmath --enable-shmop --enable-sysvsem --enable-inline-optimization --with-curlwrappers --enable-mbregex --enable-fastcgi --enable-fpm --enable-force-cgi-redirect --enable-mbstring --enable-ftp --enable-gd-native-ttf --with-openssl --enable-pcntl --enable-sockets --with-xmlrpc --enable-zip --enable-soap --without-pear --with-gettext --with-mime-magic --enable-suhosin --enable-session --with-mcrypt #配置
make #编译
make install #安装
cp php.ini-production /usr/local/php5/etc/php.ini #复制php配置文件到安装目录
rm -rf /etc/php.ini #删除系统自带配置文件
ln -s /usr/local/php5/etc/php.ini /etc/php.ini #添加软链接
cd /usr/local/php5/etc
cp php-fpm.conf.default php-fpm.conf
vi php-fpm.conf #编辑
pm.start_servers = 20 #取消前面的分号;
pm.min_spare_servers = 5
pm.max_spare_servers = 35
/usr/local/php5/sbin/php-fpm #启动php-fpm
设置 php-fpm开机启动
vi /etc/rc.d/init.d/php-fpm #新建启动文件,添加以下代码
##########################################################
#!/bin/sh
#chkconfig:345 62 62
#description:php-fpm
#
# php-fpm - this script starts and stops the php-fpm daemin
#
# chkconfig: - 85 15
# processname: php-fpm
# config: /usr/local/php/etc/php-fpm.conf
set -e
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
DESC="php-fpm daemon"
NAME=php-fpm
DAEMON=/usr/local/php5/sbin/php-fpm
CONFIGFILE=/usr/local/php5/etc/php-fpm.conf
PIDFILE=/usr/local/php5/var/run/php-fpm.pid
SCRIPTNAME=/etc/rc.d/init.d/php-fpm
# If the daemon file is not found, terminate the script.
test -x $DAEMON || exit 0
d_start(){
$DAEMON -y $CONFIGFILE || echo -n " already running"
}
d_stop(){
kill -QUIT `cat $PIDFILE` || echo -n " no running"
}
d_reload(){
kill -HUP `cat $PIDFILE` || echo -n " could not reload"
}
case "$1" in
start)
echo -n "Starting $DESC: $NAME"
d_start
echo "."
;;
stop)
echo -n "Stopping $DESC: $NAME"
d_stop
echo "."
;;
reload)
echo -n "Reloading $DESC configuration..."
d_reload
echo "Reloaded."
;;
restart)
echo -n "Restarting $DESC: $NAME"
d_stop
# Sleep for two seconds before starting again, this should give the nginx daemon some time to perform a graceful stop
sleep 2
d_start
echo "."
;;
*)
echo "Usage: $SCRIPTNAME {start|stop|restart|force-reload)" >&2
exit 3
;;
esac
exit 0
########################################################################################
chmod +x /etc/rc.d/init.d/php-fpm #添加执行权限
chkconfig php-fpm on #设置开机启动
/etc/rc.d/init.d/php-fpm start #启动php-fpm
vi /usr/local/php5/etc/php.ini #编辑配置文件
找到:;open_basedir =
修改为:open_basedir = .:/tmp/ #防止php木马跨站,重要!!
找到:disable_functions =
修改为:disable_functions = passthru,exec,system,chroot,scandir,chgrp,chown,shell_exec,proc_open,proc_get_status,ini_alter,ini_alter,ini_restore,dl,openlog,syslog,readlink,symlink,popepassthru,stream_socket_server,escapeshellcmd,dll,popen,disk_free_space,checkdnsrr,checkdnsrr,getservbyname,getservbyport,disk_total_space,posix_ctermid,posix_get_last_error,posix_getcwd, posix_getegid,posix_geteuid,posix_getgid, posix_getgrgid,posix_getgrnam,posix_getgroups,posix_getlogin,posix_getpgid,posix_getpgrp,posix_getpid, posix_getppid,posix_getpwnam,posix_getpwuid, posix_getrlimit, posix_getsid,posix_getuid,posix_isatty, posix_kill,posix_mkfifo,posix_setegid,posix_seteuid,posix_setgid, posix_setpgid,posix_setsid,posix_setuid,posix_strerror,posix_times,posix_ttyname,posix_uname
#列出PHP可以禁用的函数,如果某些程序需要用到这个函数,可以删除,取消禁用。
找到:;date.timezone =
修改为:date.timezone = PRC
找到:expose_php = On
修改为:expose_php = OFF #禁止显示php版本的信息
找到:display_errors = On
修改为:display_errors = OFF #关闭错误提示
7、安装Zend Guard
cd /usr/local/src
mkdir /usr/local/zend #建立Zend安装目录
tar xvfz ZendGuardLoader-php-5.3-linux-glibc23-i386.tar.gz #解压安装文件
cp ZendGuardLoader-php-5.3-linux-glibc23-i386/php-5.3.x/ZendGuardLoader.so /usr/local/zend/ #拷贝文件到安装目录
8、配置php支持Zend Guard
vi /usr/local/php5/etc/php.ini #编辑文件
在最后位置添加以下内容
[Zend Guard]
zend_extension=/usr/local/zend/ZendGuardLoader.so
zend_loader.enable=1
zend_loader.disable_licensing=0
zend_loader.obfuscation_level_support=3
zend_loader.license_path=
/etc/init.d/nginx restart #重启web服务器
9、配置nginx支持php
vi /usr/local/nginx/conf/nginx.conf
修改/usr/local/nginx/conf/nginx.conf 配置文件,需做如下修改
user nobody nobody; (首行user去掉注释,并与/usr/local/php5/etc/php-fpm.conf中的user,group配置同)
server {
listen 80; (修改所使用的端口)
server_name localhost; (修改所使用的服务器名)
index index.php index.html index.htm;
# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
#
location ~ \.php$ {
root html;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
(取消FastCGI server部分location的注释,并要注意fastcgi_param行的参数,改为$document_root$fastcgi_script_name,或者使用绝对路径)
完成配置后启动
/etc/init.d/nginx restart
/etc/rc.d/init.d/php-fpm restart
=======================================================
service nginx restart #重启nginx
service mysqld restart #重启mysql
到此,Nginx+MySQL+PHP+Zend基本运行环境搭建完成!
网站程序上传到/usr/local/nginx/html目录里面,如果安装有问题,请检查目录权限,确保改目录为以下权限
chown nobody.nobody -R /usr/local/nginx/html
chmod 700 -R /usr/local/nginx/html
注意:如果要用于正式生产环境,还需要进一步详细的设置配置系统的安全等各个方面,安全设置不在本次教程的范围之内,请大家参考相关系统运行安全设置方面的教程!
太难了,从正式安装开始那里开始:是不是全部将哪些.RPM包全部安装呢,还是可以安装一个名字相同的就行了