(一)安装nginx-1.6.3
1、安装nginx依赖包
mkdir -p /application mkdir -p /home/oldboy/tools yum install -y pcre pcre-devel gcc-c++ openssl openssl-devel
2、下载安装并启动nginx
useradd nginx -s /sbin/nologin -M cd /home/oldboy/tools/ wget http://nginx.org/download/nginx-1.6.3.tar.gz tar zxvf nginx-1.6.3.tar.gz cd nginx-1.6.3 ./configure --user=nginx --group=nginx --prefix=/application/nginx-1.6.3/ --with-http_stub_status_module --with-http_ssl_module make && make install ln -s /application/nginx-1.6.3 /application/nginx /application/nginx/sbin/nginx -t /application/nginx/sbin/nginx netstat -npult |grep nginx tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN 4432/nginx
(二) mysql安装在其它服务器上
(三) 安装PHP-5.5.26
1、安装php依赖包
wget -O /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-6.repo yum install zlib-devel libxml2-devel libjpeg-devel freetype-devel libpng-devel gd-devel curl-devel libxslt-devel libmcrypt-devel mhash mhash-devel mcrypt openssl-devel -y mkdir -p /home/oldboy/tools cd /home/oldboy/tools wget http://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.14.tar.gz tar zxf libiconv-1.14.tar.gz cd libiconv-1.14 ./configure --prefix=/usr/local/libiconv make make install cd ..
2、安装php
wget http://mirrors.sohu.com/php/php-5.5.26.tar.gz cd /home/oldboy/tools tar xf php-5.5.26.tar.gz cd php-5.5.26 ./configure --prefix=/application/php5.5.32 --with-mysql=mysqlnd --with-mysqli --with-gettext --with-iconv-dir=/usr/local/libiconv --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-fpm --enable-mbstring --with-mcrypt --with-gd --enable-gd-native-ttf --with-openssl --with-mhash --enable-pcntl --enable-sockets --with-xmlrpc --enable-zip --enable-soap --enable-short-tags --enable-static --with-xsl --with-fpm-user=nginx --with-fpm-group=nginx --enable-opcache=no --enable-ftp make make install ln -s /application/php5.5.26/ /application/php
3、检查结果
[root@web02 php-5.5.26]# ll /application/apache/modules/ 总用量 30568 -rw-r--r-- 1 root root 9194 11月 10 20:37 httpd.exp -rwxr-xr-x 1 root root 31285631 11月 10 23:51 libphp5.so [root@web02 php-5.5.26]# grep libphp5.so /application/apache/conf/httpd.conf LoadModule php5_module modules/libphp5.so [root@web02 php-5.5.26]# cp php.ini-production /application/php/lib/php.ini
4、为 Nginx 添加虚拟主机并整合php
cd /application/nginx/conf/ mv nginx.conf nginx.conf.bak egrep -v "#|^$" nginx.conf.bak > nginx.conf sed -i ‘10i\ include extra/*.conf;‘ nginx.conf mkdir extra cd extra/ cat zabbix.conf server { listen 80; server_name zibbix.etiantian.org; location / { root html/zibbix; index index.php index.html index.htm; } location ~ .*\.(php|php5)?$ { fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; include fastcgi.conf; } } ../../sbin/nginx -t
6、建立php测试页
<?php phpinfo(); ?>
7、建立mysql测试页
<?php $link_id=mysql_connect(‘mysql-server-ip‘,‘user‘,‘password‘) or mysql_error(); if($link_id){ echo "mysql is ok!"; } else{ echo mysql_error(); } ?>
8、重启nginx并访问php测试页
/application/nginx/sbin/nginx -s reload http://blog.etiantian.org/phpinfo.php
LNMP搭建完成
(四)安装zabbix-3.0.0
本文出自 “21种犹豫” 博客,谢绝转载!
原文地址:http://wenqiangit.blog.51cto.com/8735115/1826010