(一)、lnmp簡介
LAMP是一個縮寫,它指一組通常一起使用來運行動態網站或者服務器的開源軟件,包括:Linux操作系統,Apache網絡服務器,MySQL數據庫,Perl、PHP或者 Python 編程語言。
雖然這些開放源代碼程序本身並不是專門設計成同另外幾個程序一起工作的,但由於它們都是影響較大的開源軟件,擁有很多共同特點,這就導致了這些組件經常在一起使用。在過去的幾年裏,這些組件的兼容性不斷完善,在一起的應用情形變得更加普遍。並且它們爲了改善不同組件之間的協作,已經創建了某些擴展功能。目前,幾乎在所有的Linux發佈版中都默認包含了這些產品。Linux操作系統、Apache服務器、MySQL數據庫和Perl、PHP或者 Python語言,這些產品共同組成了一個強大的Web應用程序平臺。
(二)、環境搭建
需要安裝的包
1、安裝mysql
INSTALL-BINARY上給出的安裝步驟:
2、安裝nginx
nginx 的安裝配置
./configure \
--prefix=/usr \
--sbin-path=/usr/sbin/nginx \
--conf-path=/etc/nginx/nginx.conf \
--error-log-path=/var/log/nginx/error.log \
--http-log-path=/var/log/nginx/access.log \
--pid-path=/var/run/nginx/nginx.pid \
--lock-path=/var/lock/nginx.lock \
--user=nginx \
--group=nginx \
--with-http_ssl_module \
--with-http_flv_module \
--with-http_stub_status_module \
--with-http_gzip_static_module \
--http-client-body-temp-path=/var/tmp/nginx/client/ \ (此行可以不要)
--http-proxy-temp-path=/var/tmp/nginx/proxy/ \
--http-fastcgi-temp-path=/var/tmp/nginx/fcgi/ \
--with-pcre
make編譯
make install 安裝
測試成功
3、安裝php
cd /usr/local/usr/php*
./configure --prefix=/usr/local/php --with-mysql=/usr/local/mysql --with-openssl --enable-fpm --with-libevent-dir=/usr/local --with-mysqli=/usr/local/mysql/bin/mysql_config --enable-mbstring --with-freetype-dir --with-jpeg-dir --with-png-dir --with-zlib --with-libxml-dir=/usr --enable-xml --with-iconv-dir=/usr/local
# make ZEND_EXTRA_LIBS='-liconv' #使其識別liconv
# make install
vim php-fpm.conf
在/usr/local/php/sbin/下執行。./php-fpm啓動php-fpm
重啓nginx pkill –1 nginx
4、測試
測試nginx連接php
測試php調用mysql