漂亮蓝影 发表于 2018-5-20 09:29:25

Linux Nginx

  一、NGINX的应用场合

  1.静态服务器(图片,视频服务),另一个是lighttpd:百度贴吧、豆瓣;
  html,js,css,.flv等;
  2.动态服务,nginx+fastcgi的方式运行php,jsp。并发:500—1500;
  apache+php,lighttpd+fcgiphp;
  3.反向代理(代替处理),负载均衡(lb)。日pv2000w以下,都可以直接用nginx做代理;
  扩展:正向代理...
  4.缓存服务。
  

  二、安装 Nginx
  1.安装准备。
  1.1.安装pcre。
  ***CRE(Perl Compatible Regular Expressions)是一个Perl库,包括 perl 兼容的正则表达式库。
  ***官网:http://www.pcre.org/。
  ***安装作用:为了使Nginx支持HTTP Rewrinre模块。
  两种方法:a.编译;
  b.yum这里介绍yum安装。
  1.2安装openssl
  

  2.完整安装过程。
  2.1
  yum install -y pcre pcre-devel
  yum install openssl open-devel -y
  tar xf nginx-1.6.2.tar.gz
  cd nginx-1.6.2
  ./configure --help
  useradd -s /sbin/nologin -M nginx
  tail -1 /etc/passwd   =======>>>习惯修改检查!
  ./configure --user=nginx --group=nginx --prefix=/application/nginx1.6.2 --with-http_stub_status_module --with-http_ssl_module
  echo $?
  make && make install
  echo $?
  ln -s /application/nginx1.6.2/ /application/nginx
  2.2
  启动nginx
  /application/nginx/sbin/nginx –t====>>>>检查语法
  /application/nginx/sbin/nginx====>>>>直接启动
  netstat -lnput|grep nginx
  lsof -i :80
  curl 192.168.21.128
  Windows浏览器访问:“Welcome to nginx!”   ====>>>>安装成功!
  

  安装过程中出现的问题解决:
  1.“./configure: error: SSL modules require the OpenSSL library.
  You can either do not enable the modules, or install the OpenSSL library
  into the system, or build the OpenSSL library statically from the source
  with nginx by using --with-openssl=<path> option.
  =======================================================
  解决办法:yum install openssl openssl-devel –y    或者yum install openssl openssl* -y
  ”
  =======================================================
  

  2.Windows浏览器访问失败
  2.1.ping      ===========>>>物理通不通
  2.2.telnet   ===========>>>浏览器到web服务通不通
  2.3.服务器本地curl    =========>>>web服务开没开
  

  
页: [1]
查看完整版本: Linux Nginx