dewly_tg 发表于 2015-8-21 10:36:53

【转】lnmp配置记录

  说明:所有软件都是从官网上下载最新版的stable版本
  ###################
#
# 获取最新源码包
#
#####################
  #建立独立的webserver
#mkdir -pv /usr/local/webserver
  #放置源码包的目录
#mkdir -pv /usr/local/webserver/src
  #cd /usr/local/webserver/src
  ## php源代码
#wget http://www.php.net/get/php-5.3.4.tar.bz2/from/tw2.php.net/mirror
  ##php加速器
#wget http://bart.eaccelerator.net/source/0.9.6.1/eaccelerator-0.9.6.1.tar.bz2
  ##memcache客户端
#wget http://pecl.php.net/get/memcache-3.0.5.tgz
  ##memcached服务器端
  #wget http://memcached.googlecode.com/files/memcached-1.4.5.tar.gz
  ## mysql数据库
#wget http://dev.mysql.com/get/Downloads/MySQL-5.1/mysql-5.1.48.tar.gz/from/http://mysql.cdpa.nsysu.edu.tw/
  ## nginx 最新稳定版
#wget http://www.nginx.org/download/nginx-0.8.54.tar.gz
  #下载php-fpm,一个简单健壮的php FastCGI管理工具。这里对应的是php-5.3.X。官网推荐使用svn方式提取
  #tar jxvf php-5.3.4.tar.bz2
#cd php-5.3.
#svn co http://svn.php.net/repository/php/php-src/branches/PHP_5_3/sapi/fpm sapi/fpm
  (后注:php-5.3.5开始已经集成了fpm,不必再次co)
#查看fpm是否已经检出
#ls sapi/fpm
  ######################
#
#   安装
#
######################
  ## 安装mysql
  ## 安装php
  ##安装php的时候可能很多组件都会缺失,可以直接用yum安装这些缺失的组件
  # ./configure –prefix=/usr/local/webserver/php –with-config-file-path=/usr/local/webserver/php/etc –with-gd –enable-gd-native-ttf–with-mysql=/usr/local/webserver/mysql –enable-mbstring -enable-curl –with-mcrypt –with-zlib –with-mhash –enable-fastcgi –enable-fpm
#make
#make install
  注意:若编译的时候出现 iconv.c:1017: undefined reference to `libiconv_open’可以采取下列措施:
  解决方法:
#wget http://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.13.1.tar.gz
#tar -zxvf libiconv-1.13.1.tar.gz
#cd libiconv-1.13.1
# ./configure –prefix=/usr/local/libiconv
# make
# make install
  再在php configure的时候添加 –with-iconv=/usr/local/libiconv
  据说还有以下两种办法(没有试过):
  A: 編輯 Makefile 大約 77 行左右的地方:
EXTRA_LIBS = ….. -lcrypt
在最後加上 -liconv,例如:
EXTRA_LIBS = ….. -lcrypt -liconv
再运行make就可以了。

  
B: #make ZEND_EXTRA_LIBS=’-liconv’
#make install
  安装memcache 客户端
  具体安装详细参见: http://www.php.net/manual/en/memcache.installation.php
  #tar zxvf memcache-3.0.5.tgz
#cd memcache-3.0.5/
#/usr/local/webserver/php/bin/phpize
#./configure –with-php-config=/usr/local/webserver/php/bin/php-config
#生成   /usr/local/webserver/php/lib/php/extensions/no-debug-non-zts-20090626/memcach.so
#make && make install
  安装memcached 服务器端
  #tar zxvf
# ./configure –prefix=/usr/local/webserver/memcached
#make && make install
  #启动memcached
#/usr/local/webserver/memcached -d -m 256 -u root
  安装ea
  #cd /usr/local/webserver/src/eaccelerator-0.9.6.1
#/usr/local/webserver/php/bin/phpize#### 使用生成configure文件
# ./configure –enable-eaccelerator=shared –with-php-config=/usr/local/webserver/php/bin/php-config
#生成   /usr/local/webserver/php/lib/php/extensions/no-debug-non-zts-20090626/eaccelerator.so
  安装nginx
  # nginx需要pcre库
#yum install pcre-devel
  # 对https需要 安装ssl
#yum install openssl openssl-devel
  #cd nginx-0.8.54
#./configure
#make
#make install
  配置
  server {
listen       80;
server_namewww.abc.com;
charset utf-8;
access_loglogs/host.access.logmain;
location / {
root   /home/nginx;
indexindex.html index.htm index.php;
index index.php;
if (-f $request_filename/index.html){
rewrite (.*) $1/index.html break;
}
if (-f $request_filename/index.php){
rewrite (.*) $1/index.php;
}
if (!-f $request_filename){
rewrite (.*) /index.php;
}
  }
  error_page404            /404.html;
  # redirect server error pages to the static page /50x.html
#
error_page   500 502 503 504/50x.html;
location = /50x.html {
root   html;
  }
  # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
#
location ~ \.php$ {
fastcgi_pass   127.0.0.1:9000;
fastcgi_indexindex.php;
fastcgi_paramSCRIPT_FILENAME/home/nginx/$fastcgi_script_name;
include      fastcgi_params;
}
  # deny access to .htaccess files, if Apache’s document root
# concurs with nginx’s one
#
location ~ /\.ht {
denyall;
}
}
  ######################################
页: [1]
查看完整版本: 【转】lnmp配置记录