最近在了解一些服务器和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.安装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-mysql=/usr/local/mysql/ --with-libxml-dir=/usr/local/libxml2 --with-gd=/usr/local/gd2 --with-jpeg-dir=/usr/local/jpeg6 --with-png-dir=/usr/local/bin --with-zlib-dir=/usr/lib --with-freetype-dir=/usr/local/freetype --with-curl=/usr/local/curl/ --enable-soap --enable-
sockets --enable-mbstring --enable-ftp --enable-fastcgi
# make
# make install
# 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
大功告成!
- freetype-2.1.10.tar.gz (1.3 MB)
- 下载次数: 1
- curl-7.15.0.tar.gz (1.7 MB)
- 下载次数: 1
- gd-2.0.33.tar.gz (573.8 KB)
- 下载次数: 1
- jpegsrc.v6b.tar.gz (598.9 KB)
- 下载次数: 1
- libevent-1.4.9-stable.tar.gz (442.4 KB)
- 下载次数: 1
- libpng-1.2.8.tar.gz (498.7 KB)
- 下载次数: 1
- libiconv-1.14.tar.gz (4.8 MB)
- 下载次数: 1
- memcached-1.2.6.tar.gz (212.5 KB)
- 下载次数: 1
- libxml2-2.6.19.tar.gz (4 MB)
- 下载次数: 1
- zlib-1.2.3.tar.gz (485 KB)
- 下载次数: 1