nginx简述及安装

【概述】

nginx是种跟apache类似的web服务器。但其做为新兴事物,所以借鉴和融合了很多新技术。最为常用的除了web服务器,就是做为负载均衡使用的反向代理和缓存服务器。所以根据其功能和需求,大致的网络架构也分为LNMP、LNNMP和LNNNMP。

LNMP是和LAMP同样的平台结构。是由L(Linux)+N(nginx)+M(mysql)+P(php)组成。这时的Nginx是做web服务器使用。

LNNMP是在LNMP上做的扩展。它利用了Nginx负载均衡的反向代理功能,是LNMP平台多了负载均衡功能。

LNNNMP更是在LNNMP上的扩展。它除了拥有LNMP的平台功能和LNNMP的负载均衡功能,还额外添加了缓存服务器的功能。

【结构图】

wKioL1Qg1NOgg9zIAAEf2E_xUhE287.jpg

【nginx的编译安装】

#yum -y install gcc openssl-devel pcre-devel zlib-devel//安装编译环境

#tar xf nginx-1.4.7.tar.gz //解压源码包

#cd nginx-1.4.7

#./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/ \

  --http-uwsgi-temp-path=/var/tmp/nginx/uwsgi \

  --http-scgi-temp-path=/var/tmp/nginx/scgi \

  --with-pcre

#make && make install//编译安装

#/usr/sbin/nginx -t//检查语法错误

#useradd -r nginx//添加用户

#mkdir /var/tmp/nginx//创建目录

#/usr/sbin/nginx//启动nginx


#killall nginx//关闭手动打开的nginx进程

#vim /etc/rc.d/init.d/nginx//创建nginx启动文件

#chmod +x /etc/rc.d/init.d/nginx//赋予文件可执行权限

#chkconfig --add nginx//把nginx添加入服务

#service nginx start//开启nginx服务

#chkconfig nginx on//设置为开机启动


你可能感兴趣的:(nginx,编译安装)