Nginx是一个小巧而高效的Linux下的Web服务器软件,是由 Igor Sysoev 为俄罗斯访问量第二的 Rambler 站点开发的,已经在一些俄罗斯的大型网站上运行多年,相当的稳定。 用Nginx搭建web服务器,比Apache相比,占用更少的资源,支持更多的并发连接,体现更高的效率。

 
yum -y install gcc openssl-devel zlib-devel pcre-devel
 
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

添加用户,用户组

groupadd nginx
uesradd -g nginx -s /bin/falsh -M nginx
 
 
./configure \
 --prefix=/usr \
 --sbin-path=/usr/sbin/nginx \
 --conf-path=/etc/nginx/nginx.conf \
 --error-log-path=/var/log/nginx/error.log \
 --http-log-path=/var/log/nginx/access.log \
 --pid-path=/var/run/nginx/nginx.pid \
 --lock-path=/var/lock/nginx.lock \
 --user=nginx \
 --group=nginx \
 --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/ \
--with-pcre
 
编译,安装
make && make install
 
见附件
chkconig –add nginxd
service nginxd start

测试

键入 http://127.0.0.1  提示 Welcome  to Nginx  则成功

 

安装Mysql

安装

tar mysql-5.1.46-linux-i686-glibc23.tar.gz  -C /usr/local/                
groupadd -r mysql
useradd -r -g mysql -s /sbin/nologin -M mysql
cd /usr/local
ln –s mysql-5.1.46-linux-i686-glibc23 mysql
cd mysql
chown -R mysql:mysql .
./scripts/mysql_install_db --user=mysql
chown -R root .
chown -R mysql data
cp support-files/my-medium.cnf /etc/my.cnf           \\ 设置mysqld的配置脚本
support-files/mysql.server /etc/init.d/mysqld           \\设置mysql的启动服务                 service mysqld start|stop|restart
chkconfig --add mysqld                                       \\添加 mysqld 到chkconfig 列表中

配置

设置库文件
    新建 /etc/ld.so.conf.d/mysql.conf   
    添加 /usr/local/mysql/lib
    ldconfig -v                                                          \\ 重新加载库文件            
设置头件                                                                                                                                      l n -s /usr/local/mysql/include /usr/includemysql
设置系统路径
  编辑 /etc/profile
  添加PATH=$PATH:/usr/local/mysql/bin      
  . /etc/profile                                                         \\重新载入
make && make install
  
php的安装
分别解压,配置安装
./configure    && make && make install
php
编译,安装
./configure --prefix=/usr/local/php --with-mysql=/usr/local/mysql --with-openssl --enable-fpm --with-libevent-dir=/usr/local --with-mysqli=/usr/local/mysql/bin/mysql_config --enable-mbstring --with-freetype-dir --with-jpeg-dir --with-png-dir --with-zlib --with-libxml-dir=/usr --enable-xml --with-iconv-dir=/usr/local
 
make ZEND_EXTRA_LIBS='-liconv'
make && make install
设置php支持
nginx.conf
 43          location / {
 44              root   html;
 45              index index.php index.html index.htm;

 

 

mv /usr/loca/php/etc/php-fpm-default.conf php-fpm.conf
修改 php-fpm.conf
131 pm.max_children = 50
136 pm.start_servers = 20
141 pm.min_spare_servers = 5
146 pm.max_spare_servers = 35
152 pm.max_requests = 500
执行 ./usr/local/php/sbin/php-fpm
 
编写 phpinfo 测试
vim /www/html/index.php
<?
Phpinfo();
?>