github源码地址:链接编译安装Nginx编译nginx需要pcre、zlib、openssl库支持(需要用到它们的头文件)#!/bin/sh#linux上的nginx、php、mysql集成环境#作者salamanderset-e#"如果一个简单命令以非零状态退出,则立即退出。"basepath=$(cd`dirname$0`;pwd)#检查用户是否为rootif[$(id-u)!="0"];然后回显“错误:您必须是root才能运行此脚本,请使用root来安装lnmp”exit1fiyuminstall-ygccgcc-c++tar-zxfnginx-1.10.1.tar.gztar-zxfpcre-8.38.tar.gztar-zxfzlib-1.2.11.tar.gztar-zxfopenssl-1.1.0e.tar.gz#nginx安装注意--with-pcre=--with-zlib--with-openssl指的是源码路径cd./nginx-1.10.1./configure--prefix=/usr/local/nginx-1.10.1--with-pcre=./../pcre-8.38--with-zlib=./../zlib-1.2.11--with-openssl=./../openssl-1.1.0emakemakeinstallecho'Nginx安装成功!'注意,如果不指定路径,比如--with-pcre,表示使用默认路径(Youneedyuminstall-ypcre-devel)这样做只是想使用一个比较新的库。安装成功后进入/usr/local/nginx-1.10.1/sbin目录,在终端输入./nginx,然后在浏览器输入localhost即可看到nginx的欢迎界面。编译安装PHP需要注意mcrypt库的安装,因为yum源已经没有这个库了#!/bin/sh#linux上的nginx、php、mysql集成环境#作者salamanderset-e#》简单的话立即退出命令以非零状态退出。"basepath=$(cd`dirname$0`;pwd)#Checkifuserisrootif[$(id-u)!="0"];然后回显“错误:您必须是root才能运行此脚本,请使用root来安装lnmp”exit1fiyum-yinstalllibxml2libxml2-developensslopenssl-develcurl-devellibjpeg-devellibpng-develfreetype-develcd$basepath#installlibmcrypt库tarzxvflibmcrypt-2.5.8。tar.gzcdlibmcrypt-2.5.8./configuremakemakeinstallcd$basepath#安装??mhash库tarzxvfmhash-0.9.9.9.tar.gzcdmhash-0.9.9.9./configuremakemakeinstallcd$basepath#安装??mcrypt库tar-zxvfmcrypt-2.6.8.tar.gzcdmcrypt-2.6.8导出LD_LIBRARY_PATH=/usr/local/lib./configuremakemakeinstallcd$basepathtar-zxvfphp-7.0.16.tar.gzcd./php-7.0.16./configure\--prefix=/usr/local/php7\--with-config-file-path=/usr/local/php7/etc\--enable-fpm\--with-fpm-user=www\--with-fpm-group=www\--with-mysqli\--with-pdo-mysql\--with-libdir=lib64\--with-iconv-dir\--with-freetype-dir\--with-jpeg-dir\--with-png-dir\--with-zlib\--with-libxml-dir=/usr\--enable-xml\--disable-rpath\--enable-bcmath\--enable-shmop\--enable-sysvsem\--enable-inline-optimization\--with-curl\--enable-mbregex\--enable-mbstring\--with-mcrypt\--enable-ftp\--with-gd\--enable-gd-native-ttf\--with-openssl\--with-mhash\--enable-pcntl\--启用套接字\--with-xmlrpc\--enable-zip\--enable-soap\--without-pear\--with-gettext\--disable-fileinfo\--enable-maintainer-ztsmakemakeinstall#创建到phpln-s/usr/local/php7/的链接bin/php/usr/local/bin/echo'PHP安装成功!'这里编译安装的是PHP7,可以换成其他php版本。可以把上面的shell组合起来:集成包下一篇编译安装mysql
