日期:2011-12-08 17:25:00  来源:本站整理

Linux/Centos安装Litespeed+PHP+MYSQL教程[服务器安全]

赞助商链接



  本文“Linux/Centos安装Litespeed+PHP+MYSQL教程[服务器安全]”是由七道奇为您精心收集,来源于网络转载,文章版权归文章作者所有,本站不对其观点以及内容做任何评价,请读者自行判断,以下是其具体内容:

近来一向在折腾litespeed,感受这是一个超级节俭资源的webserver,HOSTLOC的版主cat也在举荐利用.据说,只要IP/PV不过万,利用150限制的免费版,完好可以操得动.

安装测试环境,仍旧是DS2刀(具体介绍)的VPS.真的很耐操,系统采取的是centos 32bit版本,稍后我会上关于增添虚拟主机的教程.

首先要卸载apache,进级,以及安装一些支持库:

yum -y install yum-fastestmirror
yum -y update
yum -y remove httpd
yum -y install patch make gcc gcc-c++ gcc-g77 flex bison tar
yum -y install libtool libtool-libs kernel-devel autoconf213
yum -y install libjpeg libjpeg-devel libpng libpng-devel
yum -y install freetype freetype-devel libxml2 libxml2-devel zlib zlib-devel
yum -y install file glib2 glib2-devel bzip2 diff* openldap-devel
yum -y install bzip2-devel ncurses ncurses-devel curl curl-devel e2fsprogs
yum -y install e2fsprogs-devel krb5 krb5-devel libidn libidn-devel
yum -y install openssl openssl-devel vim-minimal unzip vixie-cron
yum -y install fonts-chinese scim-chewing scim-pinyin scim-tables-chinese
export PHP_AUTOCONF=/usr/bin/autoconf-2.13
export PHP_AUTOHEADER=/usr/bin/autoheader-2.13
wget -c http://catlnmp.谷歌code.com/files/libiconv-1.13.1.tar.gz
tar zxvf libiconv-1.13.1.tar.gz
cd libiconv-1.13.1/
./configure --prefix=/usr/local
make
make install
cd ../
wget -c http://catlnmp.谷歌code.com/files/libevent-1.4.14b-stable.tar.gz
tar zxvf libevent-1.4.14b-stable.tar.gz
cd libevent-1.4.14b-stable/
./configure --prefix=/usr
make
make install
cd ../
wget -c http://catlnmp.谷歌code.com/files/libmcrypt-2.5.8.tar.gz
tar zxvf libmcrypt-2.5.8.tar.gz
cd libmcrypt-2.5.8/
./configure
make
make install
/sbin/ldconfig
cd libltdl/
./configure --enable-ltdl-install
make
make install
cd ../../
wget -c http://catlnmp.谷歌code.com/files/mhash-0.9.9.9.tar.gz
tar zxvf mhash-0.9.9.9.tar.gz
cd mhash-0.9.9.9/
./configure
make
make install
cd ../ln -s /usr/local/lib/libmcrypt.la /usr/lib/libmcrypt.la
ln -s /usr/local/lib/libmcrypt.so /usr/lib/libmcrypt.so
ln -s /usr/local/lib/libmcrypt.so.4 /usr/lib/libmcrypt.so.4
ln -s /usr/local/lib/libmcrypt.so.4.4.8 /usr/lib/libmcrypt.so.4.4.8
ln -s /usr/local/lib/libmhash.a /usr/lib/libmhash.a
ln -s /usr/local/lib/libmhash.la /usr/lib/libmhash.la
ln -s /usr/local/lib/libmhash.so /usr/lib/libmhash.so
ln -s /usr/local/lib/libmhash.so.2 /usr/lib/libmhash.so.2
ln -s /usr/local/lib/libmhash.so.2.0.1 /usr/lib/libmhash.so.2.0.1
ln -s /usr/local/bin/libmcrypt-config /usr/bin/libmcrypt-configwget -c http://catlnmp.谷歌code.com/files/mcrypt-2.6.8.tar.gz
tar zxvf mcrypt-2.6.8.tar.gz
cd mcrypt-2.6.8/
./configure
make
make install
cd ../
wget -c http://catlnmp.谷歌code.com/files/谷歌-perftools-1.6.tar.gz
tar zxvf 谷歌-perftools-1.6.tar.gz
cd 谷歌-perftools-1.6/
./configure
make && make install
echo "/usr/local/lib" > /etc/ld.so.conf.d/usr_local_lib.conf
/sbin/ldconfig
cd ../

然后安装MYSQL,注意倒数第2行为root密码:

wget -c http://catlnmp.谷歌code.com/files/mysql-5.1.50.tar.gz
tar -zxvf mysql-5.1.50.tar.gz
cd mysql-5.1.50
./configure --prefix=/usr/local/mysql --with-extra-charsets=all --enable-thread-safe-client --enable-assembler --with-charset=utf8 --enable-thread-safe-client --with-extra-charsets=all --with-big-tables --with-readline --with-ssl --with-embedded-server --enable-local-infile --without-debug --with-mysqld-ldflags=-ltcmalloc_minimal
make && make install
cd ../
groupadd mysql
useradd -g mysql mysql
cp /usr/local/mysql/share/mysql/my-medium.cnf /etc/my.cnf
/usr/local/mysql/bin/mysql_install_db --user=mysql
chown -R mysql /usr/local/mysql/var
chgrp -R mysql /usr/local/mysql/.
cp /usr/local/mysql/share/mysql/mysql.server /etc/init.d/mysql
chmod 755 /etc/init.d/mysql
chkconfig --level 345 mysql on
echo "/usr/local/mysql/lib/mysql" >> /etc/ld.so.conf
echo "/usr/local/lib" >>/etc/ld.so.conf
ldconfig
ln -s /usr/local/mysql/lib/mysql /usr/lib/mysql
ln -s /usr/local/mysql/include/mysql /usr/include/mysql
service mysql start
/usr/local/mysql/bin/mysqladmin -u root password 123456
service mysql restart
接下来,安装Litespeed.(具体安装步骤点此查看)

wget http://www.litespeedtech.com/packages/4.0/lsws-4.0.17-std-i386-linux.tar.gz
tar zxvf lsws-4.0.17-std-i386-linux.tar.gz
cd lsws-4.0.17
./install.sh

完成后,请先别关SSH,稍后需求利用.进入后台配置支持PHP:

1.登陆后台 Actions 菜单 Compile PHP

2.挑选5.3,点击背面的 next

3.在 Configure Parameters 项里输入下面代码,别的默许便可.倡议利用ea缓存组件,可以勾选eAccelerator,小夜测试这个是最给力的.

--with-mysql=mysqlnd --with-mysqli=mysqlnd --with-iconv=/usr/local --with-freetype-dir --with-jpeg-dir --with-png-dir --with-zlib --with-libxml-dir=/usr --enable-xml --disable-rpath --enable-bcmath --enable-shmop --enable-sysvsem --enable-inline-optimization --with-curl --with-curlwrappers --enable-mbregex --enable-mbstring --with-mcrypt --with-gd --enable-gd-native-ttf --with-openssl --with-mhash --enable-pcntl --enable-sockets --with-ldap --with-ldap-sasl --with-xmlrpc --enable-zip --enable-soap --enable-ftp --disable-debug --with-gettext --with-openssl

4.下一步后,千万不要革新或别的操作,静等呈现提醒信息 Next .

5.给您一行代码,您需求在ssh里面运行:

/usr/local/lsws/phpbuild/buildphp_manual_run.sh

6.其间运行2-5分钟,会呈现提醒 **COMPLETE** 则表示安装完成,假如中间有错误提醒,可以参考一下log文件.看日记部份,最下面有一个ea组件地址的.请记下来,下面有效.比方:

extension_dir = "/usr/local/lsws/lsphp5/lib/php/extensions/no-debug-non-zts-20090626/"

7.点击菜单 Actions 里面的 Graceful Restart 重启litespeed.您可以拜候 http://your.com/phpinfo.php,假如确认显示php信息,则表示安装成功.

8.Litespeed默许是不开启ea缓存组件的,需求自行配置php.ini文件.把/usr/local/lsws/php/php.ini(安装后默许生成文件)复制到/usr/local/lsws/lsphp5/lib/里(php.ini文件运行目录).

翻开php.ini,最下面加入:

extension_dir = "/usr/local/lsws/lsphp5/lib/php/extensions/no-debug-non-zts-20090626/"
extension="eaccelerator.so"
eaccelerator.shm_size="16"
eaccelerator.cache_dir="/tmp/eaccelerator"
eaccelerator.enable="1"
eaccelerator.optimizer="1"
eaccelerator.check_mtime="1"
eaccelerator.debug="0"
eaccelerator.filter=""
eaccelerator.shm_max="0"
eaccelerator.shm_ttl="0"
eaccelerator.shm_prune_period="0"
eaccelerator.shm_only="0"
eaccelerator.compress="1"
eaccelerator.compress_level="9"

注意,假如你改正过php安装目录,自行按6.中改正.然后,在ssh里履行以下号令,设定ea组件缓存目录,并设置777权限:

mkdir /tmp/eaccelerator
chmod -R 777 /tmp/eaccelerator

最后,这个时刻你用探针:http://1.2.3.4/phpinfo.php会提醒一个data的错误.找到Module Settings加入data.timezone=PRC便可以了,演示以下:

;;;;;;;;;;;;;;;;;;;
; Module Settings ;
;;;;;;;;;;;;;;;;;;;
[Date]
; Defines the default timezone used by the date functions
date.timezone = PRC

    以上是“Linux/Centos安装Litespeed+PHP+MYSQL教程[服务器安全]”的内容,如果你对以上该文章内容感兴趣,你可以看看七道奇为您推荐以下文章:

  • windows下的近似linux下的grep号令--findstr
  • linux下mysql链接被防火墙禁止的办理办法
  • Linux下mysql新建账号及权限设置办法
  • SUSE Linux下搭建Web服务器
  • Windows/Linux MySQL忘掉密码重置密码教程
  • Linux下Apache自动监测重启脚本(智能化程度较高)
  • linux备份 linux克隆 linux clone
  • <b>为什么 Linux不需求碎片整理</b>
  • CentOS6 yum搭建Linux+Nginx+PHP+MYSQL(LNMP)
  • Linux系统有效防备ARP攻击
  • Linux下 Memcache的安装和简单管理
  • 笔记本预装linux重装成windows系统
  • 本文地址: 与您的QQ/BBS好友分享!
    • 好的评价 如果您觉得此文章好,就请您
        0%(0)
    • 差的评价 如果您觉得此文章差,就请您
        0%(0)

    文章评论评论内容只代表网友观点,与本站立场无关!

       评论摘要(共 0 条,得分 0 分,平均 0 分) 查看完整评论
    Copyright © 2020-2022 www.xiamiku.com. All Rights Reserved .