• [LNMP]——LNMP环境配置


    LNMP=Linux+Nginx+Mysql+PHP

    Install Nginx

    //安装依赖包
    # yum install openssl openssl-devel zlib-devel
    
    //安装pcre
    # wget http://exim.mirror.fr/pcre/pcre-8.01.tar.gz
    # tar xf pcre-8.01.tar.gz -C /usr/local/web/
    # cd /usr/local/web/pcre-8.01/
    # ./configure 
    # make ; make install
    
    //安装libmd5
    http://ftp.mirrorservice.org/sites/ftp.wiretapped.net/pub/security/cryptography/libraries/libeay/
    # tar xf libmd5-0.8.2b.tar.gz -C /usr/local/web/
    # ls /usr/local/web/md5/
    Makefile  asm  md5.c  md5.h  md5_dgst.c  md5_locl.h  md5_one.c  md5s.cpp  md5test.c  ranlib.sh
    
    //安装Nginx
    # wget http://nginx.org/download/nginx-1.10.1.tar.gz
    # tar xf nginx-1.10.1.tar.gz -C /usr/local/web/
    # cd /usr/local/web/nginx-1.10.1/
    # useradd nginx
    # id nginx
    uid=502(nginx) gid=502(nginx) groups=502(nginx)
    # ./configure    
    --user=nginx    
    --group=nginx   
    --with-http_realip_module   
    --with-http_stub_status_module  
    --with-http_gzip_static_module  
    --with-md5=/usr/local/web/md5  
    --with-sha1=auto/lib/sha1  
    --with-pcre=/usr/local/web/pcre-8.01  
    --without-select_module  
    --without-poll_module  
    --without-http_ssi_module  
    --without-http_userid_module  
    --without-http_geo_module  
    --without-http_map_module  
    --without-http_memcached_module 
    --without-mail_pop3_module   
    --without-mail_imap_module   
    --without-mail_smtp_module   
    --prefix=/usr/local/nginx-1.10.1  
    # make;make install
    --with-http_realip_module 
    此模块支持显示真实来源IP地址,主要用于NGINX做前端负载均衡服务器使用。
    
    -with-http_stub_status_module 
    这个模块可以取得一些nginx的运行状态, 
    
    --with-http_gzip_static_module 
    这个模块在一个预压缩文件传送到开启Gzip压缩的客户端之前检查是否已经存在以“.gz”结尾的压缩文件,这样可以防止文件被重复压缩。
    
    --with-md5=/soft/md5/ 
    设定md5库文件路径
    
    --with-sha1=auto/lib/sha1 
    设定sha1库文件路径
    --with-pcre=/soft/pcre-8.01 
    设定PCRE库路径
    
    --without-select_module 
    标准连接模式。默认情况下自动编译方式。您可以启用或禁用通过使用-select_module和不带- select_module配置参数这个模块
    
    --without-poll_module 
    不使用poll模块
    
    --without-http_ssi_module 
    不使用ngx_http_ssi_module模块,此模块处理服务器端包含文件(ssi)的处理.
    
    --without-http_userid_module 
    不使用ngx_http_userid_module模块
    
    --without-http_geo_module 
    这个模块基于客户端的IP地址创建一些ngx_http_geoip_module变量,并与MaxMindGeoIP文件进行匹配,该模块仅用于 0.7.63和0.8.6版本之后。但效果不太理想,对于城市的IP记录并不是特别准确,不过对于网站的来源访问区域的分析大致有一定参考性
    。
    --without-http_map_module 
    不使用ngx_http_map_module模块
    
    --without-http_memcached_module 
    不使用ngx_http_memcached_module模块
    
    --without-mail_pop3_module 
    不允许ngx_mail_pop3_module模块
    
    --without-mail_imap_module 
    不允许ngx_mail_imap_module模块
    
    --without-mail_smtp_module 
    不允许ngx_mail_smtp_module模块
    Ngnix编译参数详解

    Install PHP

    //安装PHP依赖
    ①libxml2-2.7.7.tar.gz
    # cd /data/soft/
    #tar xf libxml2-2.7.7.tar.gz –C tmp/
    # cd tmp/libxml2-2.7.7/
    #./configure --prefix=/usr/local/services >/dev/null
    #make >/dev/null && make install >/dev/null
    
    ②curl-7.21.4.tar.gz
    # cd /data/soft/
    # tar xf curl-7.21.4.tar.gz -C tmp/
    # cd tmp/curl-7.21.4/
    #./configure --prefix=/usr/local/services >/dev/null
    #make >/dev/null && make install >/dev/null
    
    ③jpegsrc.v8b.tar.gz
    # cd /data/soft/
    #tar xf jpegsrc.v8b.tar.gz –C tmp/
    #cd tmp/jpeg-8b/
    #./configure --prefix=/usr/local/services >/dev/null
    #make >/dev/null && make install >/dev/null
    
    ④libpng-1.4.3.tar.gz
    # cd /data/soft/
    # tar xf libpng-1.4.3.tar.gz -C tmp/
    # cd tmp/libpng-1.4.3/
    #./configure --prefix=/usr/local/services >/dev/null
    #make >/dev/null && make install >/dev/null
    
    ⑤freetype-2.4.1.tar.gz
    # cd /data/soft/
    # tar xf freetype-2.4.1.tar.gz -C tmp/
    # cd tmp/freetype-2.4.1/
    #./configure --prefix=/usr/local/services >/dev/null
    #make >/dev/null && make install >/dev/null
    
    ⑥libevent-2.0.10-stable.tar.gz
    # cd /data/soft/
    # tar xf libevent-2.0.10-stable.tar.gz –C tmp/
    # cd tmp/libevent-2.0.10-stable/
    #./configure --prefix=/usr/local/services --disable-debug-mode >/dev/null
    #make >/dev/null && make install >/dev/null
    
    ⑦re2c-0.13.5.tar.gz
    # cd /data/soft/
    # tar xf re2c-0.13.5.tar.gz -C tmp/
    # cd tmp/re2c-0.13.5/
    #./configure --prefix=/usr/local/services >/dev/null
    #make >/dev/null && make install >/dev/null
    
    ⑧libmcrypt-2.5.8.tar.gz
    # cd /data/soft/
    # tar xf libmcrypt-2.5.8.tar.bz2 -C tmp/
    # cd tmp/libmcrypt-2.5.8/
    #./configure --prefix=/usr/local/services >/dev/null
    #make >/dev/null && make install >/dev/null
    # cd libltdl/
    # ./configure --prefix=/usr/local/services --enable-ltdl-install >/dev/null
    #make >/dev/null && make install >/dev/null
    //安装php
    #wget http://php.net/distributions/php-5.3.13.tar.gz
    # cd /data/soft/
    # tar xf php-5.3.13.tar.gz -C tmp/
    #cd tmp/php-5.3.13/
    # ./configure   
    --enable-zend-multibyte 
    --enable-mbstring 
    --enable-sockets 
    --enable-pdo 
    --enable-zip 
    --enable-fpm 
    --with-gd 
    --with-fpm-user=user_00 
    --with-fpm-group=user_00 
    --with-zlib 
    --with-config-file-path=/usr/local/services/php-5.3.13/etc 
    --with-libxml-dir=/usr/local/services 
    --with-curl=/usr/local/services 
    --with-png-dir=/usr/local/services 
    --with-jpeg-dir=/usr/local/services 
    --with-freetype-dir=/usr/local/services 
    --with-mysql=/usr/local/services/mysql-5.1.49 
    --with-pdo-mysql=/usr/local/services/mysql-5.1.49 
    --with-mysqli=/usr/local/services/mysql-5.1.49/bin/mysql_config 
    --prefix=/usr/local/services/php-5.3.13 
    
    # make >/dev/null && make install >/dev/null
    
    编译错误解决:
    /var/lib/mysql/mysql.sock
    configure: error: Cannot find libmysqlclient under /usr.
    Note that the MySQL client library is not bundled anymore!
    解决方法:
    cp -rp /usr/lib64/mysql/libmysqlclient.so.16.0.0 /usr/lib/libmysqlclient.so
    //安装php扩展
    ①eaccelerator-0.9.6.1.tar.bz2
    # cd /data/soft/
    #tar xf eaccelerator-0.9.6.1.tar.bz2 -C tmp/
    #cd tmp/eaccelerator-0.9.6.1/
    # /usr/local/php-5.3.13/bin/phpize 
    Configuring for:
    PHP Api Version:         20090626
    Zend Module Api No:      20090626
    Zend Extension Api No:   220090626
    #./configure --prefix=/usr/local/services/eaccelerator-0.9.6.1 --enable-eaccelerator --with-php-config=/usr/local/services/php-5.3.13/bin/php-config > /dev/null
    #make  
    # make install
    Installing shared extensions:     /usr/local/php-5.3.13/lib/php/extensions/no-debug-non-zts-20090626/
    #mkdir /tmp/eaccelerator
    #chmod 777 /tmp/eaccelerator
    
    ②memcached-1.4.13.tar.gz
    (服务器端要前安装,下面的编译扩展模块要用到)
    # cd /data/soft/
    #tar xf memcached-1.4.13.tar.gz -C tmp/
    # cd tmp/memcached-1.4.13/
    #./configure --enable-64bit --with-libevent=/usr/local/services --prefix=/usr/local/services/memcached-1.4.13 >/dev/null
    # make >/dev/null && make install >/dev/null
    
    ③libmemcached-0.48.tar.gz
    # cd /data/soft/
    #tar xf libmemcached-0.48.tar.gz -C tmp/
    #cd tmp/libmemcached-0.48/
    #CONFOPTS="
    --disable-libinnodb 
    --without-libinnodb-prefix 
    --with-libevent-prefix=/usr/local/services 
    --with-memcached=/usr/local/services/memcached-1.4.13/bin/memcached 
    --prefix=/usr/local/services 
    "
    #./configure $CONFOPTS >/dev/null
    #make >/dev/null && make install >/dev/null
    
    ④igbinary-1.0.2.tgz
    # cd /data/soft/
    # tar xf igbinary-1.0.2.tar.gz -C tmp/
    #cd tmp/igbinary-1.0.2/
    # /usr/local/php-5.3.13/bin/phpize 
    Configuring for:
    PHP Api Version:         20090626
    Zend Module Api No:      20090626
    Zend Extension Api No:   220090626
    #./configure --enable-igbinary --with-php-config=/usr/local/services/php-5.3.13/bin/php-config >/dev/null
    #make >/dev/null && make install >/dev/null
    # make install
    Installing shared extensions:     /usr/local/php-5.3.13/lib/php/extensions/no-debug-non-zts-20090626/
    Installing header files:          /usr/local/php-5.3.13/include/php/
    
    ⑤memcache-3.0.5.tgz 
    # cd /data/soft/
    # tar xf memcache-3.0.5.tgz -C tmp/
    #cd tmp/memcache-3.0.5/
    #/usr/local/services/php-5.3.13/bin/phpize
    #CONFOPTS=" 
    --enable-memcache 
    --with-php-config=/usr/local/services/php-5.3.13/bin/php-config 
    "
    #./configure $CONFOPTS >/dev/null
    #make >/dev/null && make install >/dev/null
    
    ⑥memcached-1.0.2.tgz(注意安装的顺序,igbinary-1.1.1.tgz是依赖库)
    # cd /data/soft/
    # tar xf memcached-1.0.2.tgz -C tmp/
    # cd  tmp/memcached-1.0.2/
    #/usr/local/services/php-5.3.13/bin/phpize
    #./configure  
    --enable-memcached 
    --enable-memcached-igbinary 
    --enable-memcached-json 
    --with-libmemcached-dir=/usr/local/services 
    --with-php-config=/usr/local/services/php-5.3.13/bin/php-config 
    --prefix=/usr/local/services 
    #make >/dev/null && make install >/dev/null
    
    ⑦owlient-phpredis-2.1.1-1-g90ecd17.tar.gz
    # cd /data/soft/
    #tar xf owlient-phpredis-2.1.1-1-g90ecd17.tar.gz -C tmp/
    # cd tmp/owlient-phpredis-90ecd17/
    #/usr/local/services/php-5.3.13/bin/phpize 
    #./configure --with-php-config=/usr/local/services/php-5.3.13/bin/php-config >/dev/null
    #make >/dev/null && make install >/dev/null
    //拷贝配置文件
    # cd /usr/local/services/php-5.3.13/etc
    # cp php-fpm.conf.default php-fpm.conf
    # cp /soft/php/php-5.3.13/php.ini-production php.ini

    Install Mysql(点击链接查看)

  • 相关阅读:
    实例说明Java中的null(转)
    Java中初始变量默认值
    Java中finally关键字的使用(转)
    java作用域
    import static和import的区别
    static class
    [APUE]标准IO库(下)
    [APUE]标准IO库(上)
    [APUE]文件和目录(下)
    [APUE]文件和目录(中)
  • 原文地址:https://www.cnblogs.com/snsdzjlz320/p/5835690.html
Copyright © 2020-2023  润新知