NGINX常用命令
    start nginx.exe (windows 启动命令)
    ./nginx (linux 启动命令)
    nginx -s stop 强制关闭
    nginx -s quit 安全关闭
    nginx -s reload 改变配置文件的时候,重启nginx工作进程,来时配置文件生效,重载配置
    nginx -s reopen 打开日志文件
    nginx -t 检查配置文件是否正确
    nginx -v 查看 Nginx 版本
    nginx -V 查看 Nginx 版本,详细的版本信息
    nginx -h 显示帮助信息
    注:
    ①如果Nginx未启动,可以在logs\error.log中查找原因
    ②如果日志文件没有被创建,可以在Windows事件日志中查找原因
    ③如果显示的是一个错误页面,而不是预期的页面,也可以在logs\error.log中查找原因
    ④尽管可以同时开多个Nginx线程,但是实际上只有其中一个在做所有的工作。一个Nginx可以处理 不超过1024个并发连接

    nginx -V
    可以查看该Win32平台编译版支持哪些模块。
    nginx version: nginx/1.9.3
    built with OpenSSL 1.0.1p 9 Jul 2015
    TLS SNI support enabled
    configure arguments:
    —with-cc=cl
    —builddir=objs.msvc8
    —with-debug
    —prefix=
    —conf-path=conf/nginx.conf
    —pid-path=logs/nginx.pid
    —http-log-path=logs/access.log
    —error-log-path=logs/error.log
    —sbin-path=nginx.exe
    —http-client-body-temp-path=temp/client_body_temp
    —http-proxy-temp-path=temp/proxy_temp
    —http-fastcgi-temp-path=temp/fastcgi_temp
    —http-scgi-temp-path=temp/scgi_temp
    —http-uwsgi-temp-path=temp/uwsgi_temp
    —with-cc-opt=-DFD_SETSIZE=1024
    —with-pcre=objs.msvc8/lib/pcre-8.37
    —with-zlib=objs.msvc8/lib/zlib-1.2.8
    —with-select_module
    —with-http_realip_module
    —with-http_addition_module
    —with-http_sub_module
    —with-http_dav_module
    —with-http_stub_status_module
    —with-http_flv_module
    —with-http_mp4_module
    —with-http_gunzip_module
    —with-http_gzip_static_module
    —with-http_auth_request_module
    —with-http_random_index_module
    —with-http_secure_link_module —with-mail
    —with-stream
    —with-openssl=objs.msvc8/lib/openssl-1.0.1p
    —with-openssl-opt=enable-tlsext
    —with-http_ssl_module
    —with-mail_ssl_module
    —with-stream_ssl_module
    —with-ipv6

    查看nginx进程
    windows:
    tasklist /fi “imagename eq nginx.exe”
    taskkill /F /IM nginx.exe

    linux:
    nginx:kill -HUP cat /usr/local/nginx/logs/nginx.pid

    nginx以windows服务形式启动
    instsrv Nginxc:/nginx/srvany.exe

    配置Nginx的运行参数
      可以直接将配置导入到注册表
    Windows Registry Editor Version 5.00
    [HKEY_LOCAL_MACHINE/SYSTEM/CurrentControlSet/Services/NGINX/Parameters]
    “Application”=”C://nginx//nginx.exe”
    “AppParameters”=””
    “AppDirectory”=”C://nginx//“
      注意:windows 下的Nginx 内置的module 很多没有,用Nginx -V 命令查看。

    nginx反向代理只要更改nginx.conf文件,在http/server/location层次结构下,添加proxy_pass http://localhost:7080; 一句话即可。注意不要放了;结尾。
    为了更好的发挥nginx的性能。我们将Tomcat的js、html、图片等静态文件配置到nginx上进行缓存,这样就可以提高应用的访问效率了。

    *gzip_http_version 1.0; 用了反向代理的话,末端通信是HTTP/1.0,有需求的应该也不用看我这科普文了;有这句的话注释了就行了,默认是HTTP/1.1

    location /query/ {
    if ($request_uri ~ “/query/([^?]+)”) {
    set $q $1;
    rewrite . /search?q=$q break;
    }
    proxy_pass http://www.new.com;
    }

    nginx日志中的两种时间格式:
    $time_iso8601
    时间格式为:2017-01-17T16:51:42+08:00

    $time_local
    时间格式为:17/Jan/2017:17:14:08 +0800