`
y1d2y3xyz
  • 浏览: 257085 次
  • 性别: Icon_minigender_1
  • 来自: 深圳
社区版块
存档分类
最新评论

linux下nginx+php+memcache 配置

阅读更多
最近在了解一些服务器和linux相关的东西,顺便做个记录,以备后面能用得上,做个存档

LNMP(Linux+Nginx+MySQL+PHP) 的安装网上有很多的教程,自己也是按照网上的一步步做的,前面 MySQL的安装已经讲过了,其实LNMP环境的搭建最大的问题就是PHP的安装比较麻烦。
目前我把安装包都放在 /data0/software下面

一 nginx安装,nginx安装比较简单,我装的nginx-1.0.10.tar.gz
A.操作命令如下:
# cd /data0/software
# tar -zxvf nginx-1.0.10.tar.gz
# cd nginx-1.0.10
# ./confihure --prefix=/usr/local/nginx //把nginx安装到/usr/local/nginx该目录想哦啊下,其他参数根据自己需要添加
# make;make install

B.启动nginx,
# /usr/local/nginx/sbin/nginx -c /usr/local/nginx/conf/nginx.conf
//停止nginx的命令是
# pkill -9 nginx


二 PHP安装,nginx安装比较麻烦,我装的php-5.2.17.tar.gz

安装php必须是要支持GD和libxml2支持

A.操作命令如下

a.安装 jpeg6
建立目录:
# mkdir -p /usr/local/jpeg6
# mkdir -p /usr/local/jpeg6/bin
# mkdir -p /usr/local/jpeg6/lib
# mkdir -p /usr/local/jpeg6/include
# mkdir -p /usr/local/jpeg6/man
# mkdir -p /usr/local/jpeg6/man1
# mkdir -p /usr/local/jpeg6/man/man1

# cd /data0/software
# tar -zvxf jpegsrc.v6b.tar.gz
# cd jpeg-6b
# ./configure --prefix=/usr/local/jpeg6/ --enable-shared --enable-static
# make; make install

b.安装libpng
# cd /data0/software
# tar -zvxf libpng-1.2.8.tar.gz
# cd libpng-1.2.8
# cp scripts/makefile.std makefile
# make; make install

c.安装 freetype
# cd /data0/software
# tar -zvxf freetype-2.1.10.tar.gz
# cd freetype-2.1.10
# mkdir -p /usr/local/freetype
# ./configure --prefix=/usr/local/freetype
# make;make install

d.:安装zlib
# cd /data0/software
#tar -zxvf zlib-1.2.3.tar.gz
#cd zlib-1.2.3
# ./configure
# make;make install

e.安装GD库
# cd /data0/software
# tar -zvxf gd-2.0.33.tar.gz
# mkdir -p /usr/local/gd2
# cd gd-2.0.33
# ./configure --prefix=/usr/local/gd2 --with-jpeg=/usr/local/jpeg6/ --with-png=/usr/local/lib/ --with-zlib=/usr/local/lib/ --with-freetype=/usr/local/freetype/
# make; make install

f.安装Curl库
# cd /data0/software
# tar -zxf curl-7.15.0.tar.gz
# mkdir -p /usr/local/curl
#cd curl-7.15.0
# ./configure --prefix=/usr/local/curl
# make; make install

g.安装libxml2
# cd /data0/software
# tar -zxf libxml2-2.6.19.tar.gz
# cd libxml2-2.6.19
# mkdir -p /usr/local/libxml2
# ./configure --prefix=/usr/local/libxml2
# make; make install

h.安装libmcrypt-2.5.8.tar.gz
# cd /data0/software
# tar zxvf libmcrypt-2.5.8.tar.gz
# cd libmcrypt-2.5.8
# ./configure
# make -j7 && make install
# ldconfig
# cd libltdl/
# ./configure --enable-ltdl-install
# make -j7 && make install

i.安装mhash-0.9.9.9.tar.gz
# cd /data0/software
# tar zxvf mhash-0.9.9.9.tar.gz
# cd mhash-0.9.9.9
# ./configure
# make -j7 && make install

j.安装mcrypt-2.6.8
# cd /data0/software
# tar zxvf mcrypt-2.6.8.tar.gz
# cd mcrypt-2.6.8
# ldconfig
# ./configure
# make -j7 && make install

k.安装libiconv-1.13.1.tar.gz
# cd /data0/software
# tar zxvf libiconv-1.13.1.tar.gz
# cd libiconv-1.13.1
# ./configure --prefix=/usr/local
# make -j7 && make install

l.安装php5
# cd /data0/software
# tar -zvxf php-5.2.17.tar.gz
# gzip -cd php-5.2.17-fpm-0.5.14.diff.gz | patch -d php-5.2.17 -p1
# cd php-5.2.17/
#./configure --prefix=/usr/local/php --with-config-file-path=/usr/local/php/etc --with-jpeg-dir=/usr/local/jpeg6 --with-mysql=/usr/local/mysql --with-mysqli=/usr/local/mysql/bin/mysql_config --with-iconv-dir=/usr/local --with-freetype-dir=/usr/local/freetype --with-jpeg-dir --with-png-dir=/usr/local/bin --with-zlib-dir=/usr/lib --with-libxml-dir=/usr/local/libxml2 --enable-xml --disable-rpath --enable-discard-path --enable-safe-mode --enable-bcmath --enable-shmop --enable-sysvsem --enable-inline-optimization --with-curl=/usr/local/curl --with-curlwrappers --enable-mbregex --enable-fastcgi --enable-fpm --enable-force-cgi-redirect --enable-mbstring --with-mcrypt --with-gd=/usr/local/gd2 --enable-gd-native-ttf --with-mhash --with-openssl --enable-pcntl --enable-sockets --with-ldap --with-ldap-sasl --with-xmlrpc --enable-zip --enable-ftp --enable-soap
# make
# make install

m.安装eaccelerator-0.9.6.1.tar.bz2
# cd /data0/software
# tar jxvf eaccelerator-0.9.6.1.tar.bz2
# cd eaccelerator-0.9.6.1
# /usr/local/php/bin/phpize
# ./configure --enable-eaccelerator=shared --with-php-config=/usr/local/php/bin/php-config
# make -j7 && make install

n.安装PDO_MYSQL-1.0.2.tgz
# cd /data0/software
# tar zxvf PDO_MYSQL-1.0.2.tgz
# cd PDO_MYSQL-1.0.2
# /usr/local/php/bin/phpize
# ./configure --with-php-config=/usr/local/php/bin/php-config --with-pdo-mysql=/usr/local
# make -j7 && make install

o.安装ImageMagick.tar.gz
# cd /data0/software
# tar zxvf ImageMagick.tar.gz
# cd ImageMagick-6.5.1-2/
# ./configure
# make -j7 && make install

p.安装
# cd /data0/software
# tar zxvf imagick-2.3.0.tgz
# cd imagick-2.3.0
# /usr/local/php/bin/phpize
# ./configure --with-php-config=/usr/local/php/bin/php-config
# make -j7 && make install

# vim /usr/local/php/ect/php-fpm.config ,找到下面一段
       <!-- Unix user of processes
        <value name="user">nobody</value>
       -->
      
        Unix group of processes
        <value name="group">nobody</value>


# cp php.ini-dist /usr/local/php/lib/php.ini
# cp /usr/local/php/sbin/php-fpm /etc/rc.d/init.d/php-fpm
# chmod 700 /etc/init.d/php-fpm
# service php-fpm start //启动php

通过以上的步骤php+nginx算是安装完成了,
但凡怎样的服务一般都需要设置开机启动
# vi /etc/rc.local
在文件最后添加如下语句:
ulimit -SHn 65535
/usr/local/nginx/sbin/nginx
/usr/local/php/sbin/php-fpm start

三 memcached 配置参见 http://blog.chenlb.com/2008/12/install-memcache-and-libevent.html


大功告成!
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics