编译安装Linux + Nginx1.10 + Mysql5.5 + PHP5.6

前言:本教程只编译NMP,依赖文件都用YUM,不编译了,珍爱生命,不要浪费时间!

YUM 依赖文件

yum -y install gcc gcc-c++ autoconf cmake 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 gd gd2 gd-devel gd2-devel perl-CPAN pcre-devel \
php-mcrypt  libmcrypt  libmcrypt-devel

安装Nginx

  1. 下载Nginx安装包:
    http://nginx.org/download/nginx-1.10.1.tar.gz
  2. 解压安装包:
    tar -zxf nginx-1.10.1.tar.gz -C /usr/local/
  3. cd /usr/local/nginx-1.10.1
  4. 应用配置:./configure --prefix=/code/nginx --with-http_ssl_module --with-pcre
  5. 编译与安装:make && make install
  6. 编辑配置防火墙文件: vim /etc/sysconfig/iptables 加入下面两条

-A INPUT -m state --state NEW -m tcp -p tcp --dport 80 -j ACCEPT
-A INPUT -m state --state NEW -m tcp -p tcp --dport 3306 -j ACCEPT

  1. 重启防火墙:service iptables restart

安装PHP

  1. 下载PHP安装包:http://cn2.php.net/distributions/php-5.6.5.tar.gz
  2. 解压安装包:tar zxf php-5.6.25.tar.gz -C /usr/local/
  3. cd /usr/local/php-5.6.25/
  4. 应用配置:
./configure --prefix=/usr/local/php \
--with-config-file-path=/usr/local/php/etc \
--with-mcrypt \
--with-mysqli=mysqlnd \
--with-pdo-mysql=mysqlnd \
--with-mysql-sock=/tmp/mysql.sock\
--enable-mysqlnd \
--with-gd \
--with-iconv \
--with-zlib \
--enable-bcmath \
--enable-shmop \
--enable-sysvsem \
--enable-inline-optimization \
--enable-mbregex \
--enable-fpm \
--enable-mbstring \
--enable-ftp \
--enable-gd-native-ttf \
--with-openssl \
--enable-pcntl \
--enable-sockets \
--with-xmlrpc \
--enable-zip \
--enable-soap \
--with-gettext \
--with-curl \
--with-jpeg-dir \
--with-freetype-dir
  1. 编译与安装:make && make install
  2. 配置php.ini:在/usr/local/php-5.6.25/目录下 cp php.ini-production /usr/local/php/etc/php.ini
  3. 配置php-fpm:在/usr/local/php/etc/目录下 cp php-fpm.conf.default php-fpm.conf
  4. 启动php-fpm:/usr/local/php/sbin/php-fpm

你可能感兴趣的:(编译安装Linux + Nginx1.10 + Mysql5.5 + PHP5.6)