初始系统CentOS-6.5-i386-minimal.iso
1.配置网络
#vi /etc/sysconfig/network-scripts/ifcfg-eth0 (eth0为第一块网卡,第二块eth1,以此类推)
DEVICE=eth0
IPADDR=192.168.0.200 (改成自己的IP)
NETMASK=255.255.255.0 (子网掩码)
GETWAY=192.168.0.1(网关)
ONBOO=yes
保存然后重启network
#service network restart
2.配置163的yum源(这一步可选,只是为了下载的时候快点)
#yum -y install wget
#wget http://mirrors.163.com/.help/CentOS6-Base-163.repo (下载yum源)
#cd /etc/yum.repos.d/
#mv CentOS-Base.repo CentOS-Base.repo.bk
#mv /root/CentOS6-Base-163.repo CentOS-Base.repo
#yum clean all
#yum makecache
#yum update
3.配置防火墙、开启80和3306端口
#vi /etc/sysconfig/iptables
以下两行添加到22端口后面
-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端口通过防火墙
修改保存后重启iptables生效
#service iptables restart
4.关闭SELINUX
#vi /etc/selinux/config
#SELINUX=enforcing #注释掉
#SELINUXTYPE=targeted #注释掉
SELINUX=disabled #增加
:wq #保存,关闭
#shutdown -r now #重启系统
5.安装Apache
#yum -y install httpd
#service httpd restart
此时系统提示错误
正在启动 httpd:httpd: Could not reliablydetermine the server’s fully qualified domain name, using 121.10.40.146 forServerName
解决办法:
#vi /etc/httpd/conf/httpd.conf
找到#ServerNamewww.example.com:80
修改为ServerName www.baidu.com:80 这里填入自己的域名或者localhost
:wq //保存退出
#chkconfig httpd on //设置httpd为开机启动
#service httpd restart
6.安装Mysql
#yum -yinstall mysql mysql-server
#service mysqld restart
#chkconfig mysqld on
#cp/usr/share/mysql/my-medium.cnf /etc/my.cnf
为root设置密码
#mysql_secure_installation
根据提示输入password,完成后重启MySQL
#service mysqld restart
7.安装PHP
#yum -yinstall php
安装php组件支持mysql
#yum installphp-mysql php-gd libjpeg* php-imap php-ldap php-odbc php-pear php-xmlphp-xmlrpc php-mbstring php-mcrypt php-bcmath php-mhash libmcrypt
安装完成后重新Apache、MySQL
#service mysqld restart
#service httpd restart
8.配置Apache
#vi /etc/httpd/conf/httpd.conf //编辑文件
ServerTokensOS
//在44行 修改为:ServerTokens Prod (在出现错误页的时候不显示服务器操作系统的名称)
KeepAliveOff //在76行 修改为:KeepAlive On (允许程序性联机)
MaxKeepAliveRequests100
//在83行 修改为:MaxKeepAliveRequests 1000 (增加同时连接数)
OptionsIndexes FollowSymLinks
//在331行 修改为:Options Includes ExecCGI FollowSymLinks(允许服务器执行CGI及SSI,禁止列出目录)
AllowOverrideNone
//在338行 修改为:AllowOverride All (允许.htaccess)
DirectoryIndexindex.html index.html.var
//在402行 修改为:DirectoryIndex index.html index.htm Default.htmlDefault.htm index.php Default.php index.html.var (设置默认首页文件,增加index.php)
ServerSignatureOn
//在536行 修改为:ServerSignature Off (在错误页中不显示Apache的版本)
OptionsIndexes MultiViews FollowSymLinks
//在554行 修改为 Options MultiViews FollowSymLinks(不在浏览器上显示树状目录结构)
#AddHandlercgi-script .cgi
//在796行 修改为:AddHandler cgi-script .cgi .pl (允许扩展名为.pl的CGI脚本运行)
AddDefaultCharsetUTF-8
//在759行 修改为:AddDefaultCharset GB2312 (添加GB2312为默认编码)
:wq! #保存退出
#service httpd rstart
9.配置PHP
#vi /etc/php.ini
date.timezone= PRC //在946行 把前面的分号去掉,改为date.timezone = PRC
expose_php= Off //在432行 禁止显示php版本的信息
magic_quotes_gpc= On //在745行 打开magic_quotes_gpc来防止SQL注入
short_open_tag= ON //在229行支持php短标签
:wq! //保存退出
#service mysqld restart
#service httpd restart
10.安装配置Zend Guard Loader
#wget http://downloads.zend.com/guard/5.5.0/ZendGuardLoader-php-5.3-linux-glibc23-i386.tar.gz
#wget http://downloads.zend.com/guard/5.5.0/ZendGuardLoader-php-5.3-linux-glibc23-x86_64.tar.gz
# mkdir /usr/zend #建立Zend Guard安装目录
#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/zend/
#拷贝文件到安装目录
#rm -rf/home/ZendGuardLoader-php-5.3-linux-glibc23-i386* #删除安装包
#vi /etc/php.ini
在最后一行添加以下内容
[ZendGuard]
zend_extension=/usr/zend/ZendGuardLoader.so
zend_loader.enable=1
zend_loader.disable_licensing=0
zend_loader.obfuscation_level_support=3
zend_loader.license_path=
保存后重启httpd
#service httpd restart
11.php测试
#vi /var/www/html/index.php
:wq
在浏览器输入IP访问
出现以下信息说明zend guard Loader安装成功
Thisprogram makes use of the Zend Scripting Language Engine:
ZendEngine v2.3.0, Copyright (c) 1998-2010 Zend Technologies
with Zend Guard Loader v3.3, Copyright (c)1998-2010, by Zend Technologies