当前位置 主页 > 服务器问题 > Linux/apache问题 >

    linux服务器下LNMP安装与配置方法

    栏目:Linux/apache问题 时间:2018-10-05 13:32

    现在很多朋友都选择了linux服务器下配置LNMP(linux+nginx+mysql+php),这里分享下LNMP安装与配置方法,需要的朋友可以参考下 Nginx与apache、lighttp性能综合对比,如下图:



    注意:关闭rpm默认安装的apache和mysql

    1.准备php函数的rpm包

    yum -y install gcc gcc-c++ autoconf libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel libxml2 libxml2-devel zlib zlib-devel glibc glibc-devel glib2 glib2-devel bzip2 bzip2-devel ncurses ncurses-devel curl curl-devel e2fsprogs e2fsprogs-devel krb5 krb5-devel libidn libidn-devel openssl openssl-devel openldap openldap-devel nss_ldap openldap-clients openldap-servers

    2.准备lnmp其他的源代码包

    wget http://blog.s135.com/soft/linux/nginx_php/nginx/nginx-0.8.46.tar.gz
    wget http://blog.s135.com/soft/linux/nginx_php/php/php-5.2.14.tar.gz
    wget http://blog.s135.com/soft/linux/nginx_php/phpfpm/php-5.2.14-fpm-0.5.14.diff.gz
    wget http://blog.s135.com/soft/linux/nginx_php/mysql/mysql-5.5.3-m3.tar.gz
    wget http://blog.s135.com/soft/linux/nginx_php/libiconv/libiconv-1.13.1.tar.gz
    wget http://blog.s135.com/soft/linux/nginx_php/mcrypt/libmcrypt-2.5.8.tar.gz
    wget http://blog.s135.com/soft/linux/nginx_php/mcrypt/mcrypt-2.6.8.tar.gz
    wget http://blog.s135.com/soft/linux/nginx_php/memcache/memcache-2.2.5.tgz
    wget http://blog.s135.com/soft/linux/nginx_php/mhash/mhash-0.9.9.9.tar.gz
    wget http://blog.s135.com/soft/linux/nginx_php/pcre/pcre-8.10.tar.gz
    wget http://blog.s135.com/soft/linux/nginx_php/eaccelerator/eaccelerator-0.9.6.1.tar.bz2
    wget http://blog.s135.com/soft/linux/nginx_php/pdo/PDO_MYSQL-1.0.2.tgz
    wget http://blog.s135.com/soft/linux/nginx_php/imagick/ImageMagick.tar.gz
    wget http://blog.s135.com/soft/linux/nginx_php/imagick/imagick-2.3.0.tgz

    3.安装php-5.2.14源代码包所需要的函数支持包

    复制代码 代码如下:
    tar zxvf libiconv-1.13.1.tar.gz
    cd libiconv-1.13.1/
    ./configure --prefix=/usr/local
    make
    make install
    cd ../

    (libiconv库为需要做转换的应用提供了一个iconv()的函数,以实现一个字符编码到另一个字符编码的转换)

    复制代码 代码如下:
    tar zxvf libmcrypt-2.5.8.tar.gz
    cd libmcrypt-2.5.8/
    ./configure
    make
    make install
    cd libltdl/
    ./configure --enable-ltdl-install
    make
    make install
    cd ../../

    (libmcrypt是加密算法扩展库。支持DES, 3DES, RIJNDAEL, Twofish, IDEA, GOST, CAST-256, ARCFOUR, SERPENT, SAFER+等算法。)

    复制代码 代码如下:
    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