Lnmp环境部置
1) 安装编译环境安装
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 curl curl-devel ssse2fsprogs e2fsprogs-devel krb5 krb5-devel libidn libidn-devel openssl openssl-devel openldap openldap-devel nss_ldap openldap-clients openldap-servers
2)安装nginx
[root@server1 nginx-1.1.13]# yum -y install pcre-devel openssl openssl-devel
root@server1 nginx]# groupadd www
[root@server1 nginx]# useradd -g www -s /sbin/nologin www
[root@server1 nginx]# tar -xzvf nginx-1.1.13.tar.gz
[root@server1 nginx]# cd nginx-1.1.13
[root@server1 nginx-1.1.13]# mkdir -p /usr/local/webserver/nginx
[root@server1 nginx-1.1.13]#
./configure --user=www --group=www --prefix=/usr/local/webserver/nginx --sbin-path=/usr/local/webserver/nginx/sbin/nginx --conf-path=/usr/local/webserver/nginx/conf/nginx.conf --with-http_stub_status_module --with-http_ssl_module --with-pcre --lock-path=/var/run/nginx.lock --pid-path=/var/run/nginx.pid
[root@server1 nginx-1.1.13]# make && make install
[root@server1 nginx-1.1.13]# vim /usr/local/webserver/nginx/conf/nginx.con
server {
listen 80;
server_name www.xiao.com;
[root@server1 conf]# /usr/local/webserver/nginx/sbin/nginx/nginx –t (检测进程及配置文件)
nginx: the configuration file /usr/local/webserver/nginx/conf/nginx.conf syntax is ok
nginx: configuration file /usr/local/webserver/nginx/conf/nginx.conf test is successful
[root@server1 conf]# /usr/local/webserver/nginx/sbin/nginx/nginx (启动服务器)
3)mysql install
[root@server1 software]# yum -y install mysql-serve
[root@server1 software]# servcie mysqld restart
4)php install
[root@server1 php]# yum -y install libevent
[root@server1 php-5.3.17]# yum -y install mysql-devel(要装这个,不然编译会报找mysql头文件)
[root@server1 php-5.3.17]# find / -name mysql.h
/usr/include/mysql/mysql.h(找头文件的路径)
[root@server1 php]# tar -zxvf php-5.4.8.tar.gz
[root@server1 php]# cd php-5.4.8
[root@server1 php-5.4.8]#./configure
--prefix=/usr/local/php \
--with-apxs2=/usr/local/apache/bin/apxs \
--with-libxml-dir=/usr/include/libxml2 \
--with-config-file-path=/usr/local/php/etc \
--with-mysql=/usr/local/mysql \
--with-mysqli=/usr/local/mysql/bin/mysql_config \
--with-gd \
--enable-gd-native-ttf \
--with-zlib --with-mcrypt=/usr/local/libmcrypt \
--with-pdo-mysql=/usr/local/mysql \
--enable-shmop \
--enable-soap \
--enable-sockets \
--enable-wddx \
--enable-zip \
--with-xmlrpc \
--enable-fpm \
--enable-mbstring \
--with-zlib-dir \
--with-bz2 \
--with-curl \
--enable-exif \
--enable-ftp \
--with-jpeg-dir=/usr/lib64 \
--with-png-dir=/usr/lib64 \
--with-freetype-dir=/usr/lib64 \
--with-iconv \
--enable-xml \
--enable-bcmath \
--enable-sysvsem \
--enable-inline-optimization \
--with-curlwrappers \
--enable-mbregex \
--with-openssl \
--enable-pcntl \
--with-gettext \
--enable-session \
--enable-pdo \
--prefix=/usr/local/php \
--with-apxs2=/usr/local/apache/bin/apxs \
--with-libxml-dir=/usr/include/libxml2 \
--with-config-file-path=/usr/local/php/etc \
--with-mysql=/usr/local/mysql \
--with-mysqli=/usr/local/mysql/bin/mysql_config \
--with-gd \
--enable-gd-native-ttf \
--with-zlib --with-mcrypt=/usr/local/libmcrypt \
--with-pdo-mysql=/usr/local/mysql \
--enable-shmop \
--enable-soap \
--enable-sockets \
--enable-wddx \
--enable-zip \
--with-xmlrpc \
--enable-fpm \
--enable-mbstring \
--with-zlib-dir \
--with-bz2 \
--with-curl \
--enable-exif \
--enable-ftp \
--with-jpeg-dir=/usr/lib64 \
--with-png-dir=/usr/lib64 \
--with-freetype-dir=/usr/lib64 \
--with-iconv \
--enable-xml \
--enable-bcmath \
--enable-sysvsem \
--enable-inline-optimization \
--with-curlwrappers \
--enable-mbregex \
--with-openssl \
--enable-pcntl \
--with-gettext \
--enable-session \
--enable-pdo \
php
安装目录
--with-apxs2=/usr/local/apache/bin/apxs
--with-config-file-path=/usr/local/php/etc 指定 php.ini 位置
--with-MySQL=/usr/local/mysql mysql 安装目录,对 mysql 的支持
--with-mysqli=/usr/local/mysql/bin/mysql_config mysqli 文件目录 , 优化支持
--enable-safe-mode 打开安全模式
--enable-ftp 打开 ftp 的支持
--enable-zip 打开对 zip 的支持
--with-bz2 打开对 bz2 文件的支持
--with-jpeg-dir 打开对 jpeg 图片的支持
--with-png-dir 打开对 png 图片的支持
--with-freetype-dir 打开对 freetype 字体库的支持
--without-iconv 关闭 iconv 函数,种字符集间的转换
--with-libXML-dir 打开 libxml2 库的支持
--with-xmlrpc 打开 xml-rpc 的 c 语言
--with-zlib-dir 打开 zlib 库的支持
--with-gd 打开 gd 库的支持
--enable-gd-native-ttf 支持 TrueType 字符串函数库
--with-curl 打开 curl 浏览工具的支持
--with-curlwrappers 运用 curl 工具打开 url 流
--with-ttf 打开 freetype1.* 的支持,可以不加了
--with-xsl 打开 XSLT 文件支持,扩展了 libxml2 库 ,需要 libxslt 软件
--with-gettext 打开 gnu 的 gettext 支持,编码库用到
--with-pear 打开 pear 命令的支持, php 扩展用的
--enable-calendar 打开日历扩展功能
--enable-mbstring 多字节,字符串的支持
--enable-bcmath 打开图片大小调整 , 用到 zabbix 监控的时候用到了这个模块
--enable-sockets 打开 sockets 支持
--enable-exif 图片的元数据支持
--enable-magic-quotes 魔术引用的支持
--disable-rpath 关闭额外的运行库文件
--disable-debug 关闭调试模式
--with-mime-magic=/usr/share/file/magic.mime 魔术头文件位置
CGI 方式安装才用的参数
--enable-fpm 打上 php-fpm 补丁后才有这个参数, cgi 方式安装的启动程序
--enable-fastcgi 支持 fastcgi 方式启动 php
--enable-force-cgi-redirect 同上 , 帮助里没有解释
--with-ncurses 支持 ncurses 屏幕绘制以及基于文本终端的图形互动功能的动态库
--enable-pcntl freeTDS 需要用到的,可能是链接 mssql 才用到
mhash 和 mcrypt 算法的扩展
--with-mcrypt 算法
--with-mhash 算法
--with-gmp
--enable-inline-optimization
--with-openssl openssl 的支持,加密传输时用到的
--enable-dbase
--with-pcre-dir=/usr/local/bin/pcre-config perl 的正则库案安装位置
--disable-dmalloc
--with-gdbm dba 的 gdbm 支持
--enable-sigchild
--enable-sysvsem
--enable-sysvshm
--enable-zend-multibyte 支持 zend 的多字节
--enable-mbregex
--enable-wddx
--enable-shmop
--enable-soap
--with-apxs2=/usr/local/apache/bin/apxs
--with-config-file-path=/usr/local/php/etc 指定 php.ini 位置
--with-MySQL=/usr/local/mysql mysql 安装目录,对 mysql 的支持
--with-mysqli=/usr/local/mysql/bin/mysql_config mysqli 文件目录 , 优化支持
--enable-safe-mode 打开安全模式
--enable-ftp 打开 ftp 的支持
--enable-zip 打开对 zip 的支持
--with-bz2 打开对 bz2 文件的支持
--with-jpeg-dir 打开对 jpeg 图片的支持
--with-png-dir 打开对 png 图片的支持
--with-freetype-dir 打开对 freetype 字体库的支持
--without-iconv 关闭 iconv 函数,种字符集间的转换
--with-libXML-dir 打开 libxml2 库的支持
--with-xmlrpc 打开 xml-rpc 的 c 语言
--with-zlib-dir 打开 zlib 库的支持
--with-gd 打开 gd 库的支持
--enable-gd-native-ttf 支持 TrueType 字符串函数库
--with-curl 打开 curl 浏览工具的支持
--with-curlwrappers 运用 curl 工具打开 url 流
--with-ttf 打开 freetype1.* 的支持,可以不加了
--with-xsl 打开 XSLT 文件支持,扩展了 libxml2 库 ,需要 libxslt 软件
--with-gettext 打开 gnu 的 gettext 支持,编码库用到
--with-pear 打开 pear 命令的支持, php 扩展用的
--enable-calendar 打开日历扩展功能
--enable-mbstring 多字节,字符串的支持
--enable-bcmath 打开图片大小调整 , 用到 zabbix 监控的时候用到了这个模块
--enable-sockets 打开 sockets 支持
--enable-exif 图片的元数据支持
--enable-magic-quotes 魔术引用的支持
--disable-rpath 关闭额外的运行库文件
--disable-debug 关闭调试模式
--with-mime-magic=/usr/share/file/magic.mime 魔术头文件位置
CGI 方式安装才用的参数
--enable-fpm 打上 php-fpm 补丁后才有这个参数, cgi 方式安装的启动程序
--enable-fastcgi 支持 fastcgi 方式启动 php
--enable-force-cgi-redirect 同上 , 帮助里没有解释
--with-ncurses 支持 ncurses 屏幕绘制以及基于文本终端的图形互动功能的动态库
--enable-pcntl freeTDS 需要用到的,可能是链接 mssql 才用到
mhash 和 mcrypt 算法的扩展
--with-mcrypt 算法
--with-mhash 算法
--with-gmp
--enable-inline-optimization
--with-openssl openssl 的支持,加密传输时用到的
--enable-dbase
--with-pcre-dir=/usr/local/bin/pcre-config perl 的正则库案安装位置
--disable-dmalloc
--with-gdbm dba 的 gdbm 支持
--enable-sigchild
--enable-sysvsem
--enable-sysvshm
--enable-zend-multibyte 支持 zend 的多字节
--enable-mbregex
--enable-wddx
--enable-shmop
--enable-soap
[root@server1 php-5.3.17]#
ZEND_EXTRA_LIBS='-liconv'
[root@server1 php-5.3.17]#make && make install
[root@server1 php-5.3.17]# make test
root@server1 //]# mkdir -p /www/html/
[root@server1 //]# vim /www/html/index.php
Phpinfo();
?>
[root@server1 /]# chown -R www:www www
~
[root@server1 etc]# mv /usr/local/php/etc/php-fpm.conf.default php-fpm.conf
[root@server1 etc]# Vim php-fpm.conf
217 pm.max_children = 50
236 pm.start_servers = 20
241 pm.min_spare_servers = 5
227 pm.min_spare_servers =5
243 pm.max_requests = 500
[root@server1 sbin]# /usr/local/php/sbin/php-fpm
[root@server1 sbin]# vim /etc/nginx/nginx.conf
root
/www/html;
index index.html index.htm index.php;
}
location ~ .*\.php{
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
include fcgi.conf;
[root@server1 conf]# cp fastcgi.conf fcgi.conf