LNMP
nginx PHP5 mysql
fastcgi_pass→FastCGI←→ mysql_connet() → connect DBMS→
mysql_select_db() → connect Database→ data
系统: centos6.8 64位 最小化安装 2.6.32-642.el6.x86_64
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 gd gd-devel curl curl-devel e2fsprogs e2fsprogs-devel krb5-devel libidn libidn-devel openssl openssl-devel openldap openldap-devel nss_ldap openldap-clients openldap-servers pcre pcre-devel ImageMagick ImageMagick-devel
mkdir /hequan && cd /hequan
wget http://cn2.php.net/distributions/php-5.6.22.tar.bz2
wget http://nginx.org/download/nginx-1.11.0.tar.gz
wget http://cdn.mysql.com//Downloads/MySQL-5.7/mysql-5.7.12.tar.gz
useradd -s /sbin/nologin -M nginx
tar xf nginx-1.11.0.tar.gz
cd nginx-1.11.0
./configure --user=nginx --group=nginx --prefix=/application/nginx1.11.0 \
--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/ \
--http-uwsgi-temp-path=/var/tmp/nginx/uwsgi \
--http-scgi-temp-path=/var/tmp/nginx/scgi \
--with-pcre
make && make install
mkdir -p /var/tmp/nginx/client
ln -s /application/nginx1.11.0/ /application/nginx
/application/nginx/sbin/nginx
yum -y install gcc gcc-c++ autoconf automake zlib* fiex* libxml* ncurses-devel libmcrypt* libtool-ltdl-devel* make cmake libaio libaio-devel autoconf bzr bison libtool
groupadd mysql
useradd -r -g mysql mysql -M -s /sbin/nologin
tar -zxvf mysql-5.7.12.tar.gz
mkdir -p /application/mysql/data
chown -R mysql.mysql /application/mysql/data/
chown -R mysql:mysql /application/mysql
wget http://sourceforge.net/projects/boost/files/boost/1.59.0/boost_1_59_0.tar.gz
tar zxvf boost_1_59_0.tar.gz -C /application/boost
cd mysql-5.7.12
cmake \
-DCMAKE_INSTALL_PREFIX=/application/mysql \
-DMYSQL_DATADIR=/application/mysql/data \
-DMYSQL_UNIX_ADDR=/tmp/mysql.sock \
-DDEFAULT_CHARSET=utf8 \
-DMYSQL_USER=mysql\
-DDEFAULT_COLLATION=utf8_general_ci \
-DEXTRA_CHARSETS=all \
-DMYSQL_TCP_PORT=3306 \
-DSYSCONFDIR=/etc \
-DENABLED_LOCAL_INFILE=1 \
-DDOWNLOAD_BOOST=1 \
-DWITH_BOOST=/application/boost/
make -j 2 && make install
cd /application/mysql/bin
./mysqld --initialize --user=mysql --datadir=/application/mysql/data --basedir=/application/mysql --socket=/tmp/mysql.sock
cd /application/mysql/support-files/
cp mysql.server /etc/init.d/mysqld
cp my-default.cnf /etc/my.cnf
chmod 755 /etc/init.d/mysqld
chkconfig --add mysqld
chkconfig mysqld on
sed -i "/# port = */c port = 3306" /etc/my.cnf
sed -i "/# basedir = */c basedir= /application/mysql" /etc/my.cnf
sed -i "/# datadir = */c datadir = /application/mysql/data" /etc/my.cnf
sed -i "/# socket = */c socket = /tmp/mysql.sock" /etc/my.cnf
/etc/init.d/mysql start
echo "PATH=/application/mysql/bin:/application/mysql/lib:$PATH" >> /etc/profile
echo "export PATH " >> /etc/profile
source /etc/profile
vi /etc/my.cnf
[mysqld]
port=3306
basedir=/application/mysql
datadir=/application/mysql/data
socket=/tmp/mysql.sock
/etc/init.d/mysql start
2016-05-30T05:06:59.388996Z 1 [Note] A temporary password is generated for root@localhost: %+TbbU
mysql -uroot -p'%+TbbU set password=password('yourpassword'); alter user 'root'@'localhost' password expire never; flush privileges; wget http://ncu.dl.sourceforge.net/project/mhash/mhash/0.9.9.9/mhash-0.9.9.9.tar.gz wget http://nchc.dl.sourceforge.net/project/mcrypt/Libmcrypt/2.5.8/libmcrypt-2.5.8.tar.gz wget http://nchc.dl.sourceforge.net/project/mcrypt/MCrypt/2.6.8/mcrypt-2.6.8.tar.gz wget http://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.14.tar.gz wget http://pecl.php.net/get/memcache-2.2.7.tgz wget http://xcache.lighttpd.net/pub/Releases/3.2.0/xcache-3.2.0.tar.gz wget http://pecl.php.net/get/imagick-3.1.2.tgz tar -zvxf libiconv-1.14.tar.gz cd libiconv-1.14/srclib sed -i -e '/gets is a security/d' ./stdio.in.h cd ../ ./configure --prefix=/application/ make make install cd /hequan 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 /hequan tar -zxvf mhash-0.9.9.9.tar.gz cd mhash-0.9.9.9/ ./configure make make install 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 ln -s /usr/local/lib/libmhash.la /usr/lib/libmhash.la ln -s /usr/local/lib/libmhash.so /usr/lib/libmhash.so ln -s /usr/local/lib/libmhash.so.2 /usr/lib/libmhash.so.2 ln -s /usr/local/lib/libmhash.so.2.0.1 /usr/lib/libmhash.so.2.0.1 ln -s /usr/local/bin/libmcrypt-config /usr/bin/libmcrypt-config cd /hequan tar -zxvf mcrypt-2.6.8.tar.gz cd mcrypt-2.6.8 export LD_LIBRARY_PATH=/usr/local/lib: LD_LIBRARY_PATH ./configure make make install cd /hequan/ tar -jxvf php-5.6.22.tar.bz2 cd php-5.6.22 ./configure --prefix=/application/php --with-config-file-path=/application/php/etc --enable-fpm --with-fpm-user=www --with-fpm-group=www --with-mysql=mysqlnd --with-mysqli=mysqlnd --with-pdo-mysql=mysqlnd --with-iconv-dir --with-freetype-dir --with-jpeg-dir --with-png-dir --with-zlib --with-libxml-dir=/usr --enable-xml --disable-rpath --enable-magic-quotes --enable-safe-mode --enable-bcmath --enable-shmop --enable-sysvsem --enable-inline-optimization --with-curl --with-curlwrappers --enable-mbregex --enable-mbstring --with-mcrypt --enable-ftp --with-gd --enable-gd-native-ttf --with-openssl --with-mhash --enable-pcntl --enable-sockets --with-xmlrpc --enable-zip --enable-soap --without-pear --with-gettext --disable-fileinfo --enable-maintainer-zts make ZEND_EXTRA_LIBS='-liconv' make install cp php.ini-production /application/php/etc/php.ini cp sapi/fpm/init.d.php-fpm /etc/init.d/php-fpm chmod u+x /etc/init.d/php-fpm chkconfig --add php-fpm chkconfig php-fpm on groupadd www useradd -s /sbin/nologin -g www -M www mv /application/php/etc/php-fpm.conf.default /application/php/etc/php-fpm.conf ln -s /application/php/etc/php.ini /etc/php.ini ln -s /application/php/etc/php-fpm.conf /etc/php-fpm.conf /application/php/sbin/php-fpm zlib====》提供数据压缩用的函式库 pcre====》rewrite的支持库 openssl====》https的支持库 libiconv====》字符编码转换库 libxml====》XML库 libpng====》图片库 freetype====》字库 libmcrypt====》加密算法 mhash====》加密库 curl====》URL传输 gd====》绘图