0
点赞
收藏
分享

微信扫一扫

Nginx-安装部署


Nginx

正向代理与反向代理

  1. 正向代理:正向代理的对象是客户端;

  2. 反向代理:反向代理的对象是服务端;

常用的Web服务器介绍

apache、Nginx、tomcat、weblogic、iis、jboss、websphere、jetty、netty、lighttpd、glassfish、resin 等。

安装

  1. 解压 tar zxvf ngnginx-1.17.0.tar.gz

  2. 设置安装目录 ./configure --prefix=/usr/lcoal/nginx

  3. 常见错误:

  1. ./configure: error: the HTTP rewrite module requires the PCRE library.

    You can either disable the module by using --without-http_rewrite_module

    option, or install the PCRE library into the system, or build the PCRE library

    statically from the source with nginx by using --with-pcre=<path> option.

    解决方法:yum -y install pcre-devel

  2. ./configure: error: the HTTP gzip module requires the zlib library.

    You can either disable the module by using --without-http_gzip_module

    option, or install the zlib library into the system, or build the zlib library

    statically from the source with nginx by using --with-zlib=<path> option.

    解决方法:yum install -y zlib-devel

  3. 如果yum无法执行,请查看:

  4. 安装并且编译 make && make install

目录介绍

  1. conf: 配置文件

  2. html:存静态文件

  3. logs:日志文件

  4. sbin:脚本文件

启动与停止

  1. 启动

  1. ./nginx -c /usr/local/nginx/conf/nginx.conf -c 标识指定文件启动;

  2. ./nginx 默认加载当前目录conf下nginx.conf文件;

  1. 停止

  1. 脚本

  1. ./nginx -s stop 停止

  2. ./nginx -s quit 退出

  3. ./nginx -s reload 重新加载

  1. 发送信号方式

  1. 查找进程 ps -ef |grep nginx 找到master进程号通过 kill -QUIT xxxx 停止;原理:nginx会关闭请求,处理当前剩余请求后再停止。

  2. kill -9 xxxx

  3. kill -TERM xxxx


举报

相关推荐

0 条评论