[LNMP]——LNMP环境配置
生活随笔
收集整理的這篇文章主要介紹了
[LNMP]——LNMP环境配置
小編覺(jué)得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.
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 此模塊支持顯示真實(shí)來(lái)源IP地址,主要用于NGINX做前端負(fù)載均衡服務(wù)器使用。-with-http_stub_status_module 這個(gè)模塊可以取得一些nginx的運(yùn)行狀態(tài), --with-http_gzip_static_module 這個(gè)模塊在一個(gè)預(yù)壓縮文件傳送到開(kāi)啟Gzip壓縮的客戶端之前檢查是否已經(jīng)存在以“.gz”結(jié)尾的壓縮文件,這樣可以防止文件被重復(fù)壓縮。--with-md5=/soft/md5/ 設(shè)定md5庫(kù)文件路徑--with-sha1=auto/lib/sha1 設(shè)定sha1庫(kù)文件路徑 --with-pcre=/soft/pcre-8.01 設(shè)定PCRE庫(kù)路徑--without-select_module 標(biāo)準(zhǔn)連接模式。默認(rèn)情況下自動(dòng)編譯方式。您可以啟用或禁用通過(guò)使用-select_module和不帶- select_module配置參數(shù)這個(gè)模塊--without-poll_module 不使用poll模塊--without-http_ssi_module 不使用ngx_http_ssi_module模塊,此模塊處理服務(wù)器端包含文件(ssi)的處理.--without-http_userid_module 不使用ngx_http_userid_module模塊--without-http_geo_module 這個(gè)模塊基于客戶端的IP地址創(chuàng)建一些ngx_http_geoip_module變量,并與MaxMindGeoIP文件進(jìn)行匹配,該模塊僅用于 0.7.63和0.8.6版本之后。但效果不太理想,對(duì)于城市的IP記錄并不是特別準(zhǔn)確,不過(guò)對(duì)于網(wǎng)站的來(lái)源訪問(wèn)區(qū)域的分析大致有一定參考性 。 --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編譯參數(shù)詳解?
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⑧l(xiāng)ibmcrypt-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編譯錯(cuò)誤解決: /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擴(kuò)展 ①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 (服務(wù)器端要前安裝,下面的編譯擴(kuò)展模塊要用到) # 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是依賴庫(kù)) # 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(點(diǎn)擊鏈接查看)
?
轉(zhuǎn)載于:https://www.cnblogs.com/snsdzjlz320/p/5835690.html
總結(jié)
以上是生活随笔為你收集整理的[LNMP]——LNMP环境配置的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問(wèn)題。
- 上一篇: 异步提交表单插件jquery.form.
- 下一篇: web框架django初探