zoukankan      html  css  js  c++  java
  • 【Nginx】nginx日常命令

    看下nginx命令的帮助信息

    [root@localhost oa_workflow_test]# /usr/local/nginx/sbin/nginx -h
    nginx version: nginx/1.12.0
    Usage: nginx [-?hvVtTq] [-s signal] [-c filename] [-p prefix] [-g directives]
    
    Options:
      -?,-h         : this help
      -v            : show version and exit
      -V            : show version and configure options then exit
      -t            : test configuration and exit
      -T            : test configuration, dump it and exit
      -q            : suppress non-error messages during configuration testing
      -s signal     : send signal to a master process: stop, quit, reopen, reload
      -p prefix     : set prefix path (default: /usr/local/nginx/)
      -c filename   : set configuration file (default: conf/nginx.conf)
      -g directives : set global directives out of configuration file

    查看nginx版本

    [root@localhost ~]# nginx -v (注意是小v)
    nginx version: nginx/1.12.0

    查看nginx安装了哪些模块

    [root@localhost ~]# nginx -V(注意是大V)
    nginx version: nginx/1.12.0
    built by gcc 4.8.5 20150623 (Red Hat 4.8.5-11) (GCC)
    built with OpenSSL 1.0.1e-fips 11 Feb 2013
    TLS SNI support enabled
    configure arguments: --user=www --group=www --prefix=/usr/local/nginx --with-http_ssl_module --with-http_stub_status_module --with-threads

    可以格式化后显示

    [root@localhost ~]# nginx -V 2>&1 | sed "s/s+--/
     --/g"
    nginx version: nginx/1.12.0
    built by gcc 4.8.5 20150623 (Red Hat 4.8.5-11) (GCC)
    built with OpenSSL 1.0.1e-fips 11 Feb 2013
    TLS SNI support enabled
    configure arguments:
     --user=www
     --group=www
     --prefix=/usr/local/nginx
     --with-http_ssl_module
     --with-http_stub_status_module
     --with-threads

    重读nginx配置文件

    [root@localhost conf]# /usr/local/nginx/sbin/nginx -s reopen

     检查配置文件是否正确

     -t 参数 ,不运行nginx,而仅仅测试配置文件。nginx 将检查配置文件的语法的正确性,并尝试打开配置文件中所引用到的文件。

    [root@localhost conf]# /usr/local/nginx/sbin/nginx -t
    nginx: the configuration file /usr/local/nginx/conf/nginx.conf syntax is ok
    nginx: configuration file /usr/local/nginx/conf/nginx.conf test is successful

     后面也可以指定配置文件地址

    [root@oa-dev conf]# /opt/app/nginx/sbin/nginx -t -c /opt/app/nginx/conf/nginx.conf
    nginx: [warn] "ssl_stapling" ignored, issuer certificate not found for certificate "/opt/app/nginx/conf/ssl/server2018.crt"
    nginx: the configuration file /opt/app/nginx/conf/nginx.conf syntax is ok
    nginx: configuration file /opt/app/nginx/conf/nginx.conf test is successful

    查看nginx进程信息

    [root@oa-dev conf]# ps -ef|grep nginx
    root       961     1  0 04:24 ?        00:00:00 nginx: master process /opt/app/nginx/sbin/nginx
    nobody     970   961  0 04:24 ?        00:00:00 nginx: worker process
    nobody     971   961  0 04:24 ?        00:00:00 nginx: worker process

    nginx -h 查看帮助信息
    nginx -v 查看Nginx的版本号
    nginx -V 显示Nginx的版本号和编译信息
    start nginx 启动Nginx
    nginx -s stop 快速停止和关闭Nginx
    nginx -s quit 正常停止或关闭Nginx
    nginx -s reload 配置文件修改重新加载
    nginx -t 测试Nginx配置文件的正确性及配置文件的详细信息 

  • 相关阅读:
    zbb20170802 Windows平台使用Gitblit搭建Git服务器图文教程
    zbb20170728 oracle 查看被锁对象
    zbb20170726 Spring Controller 获取请求参数的几种方法
    zbb20170726 spring访问静态文件访问
    zbb20170720 extjs 类似桌面的页面布局
    zbb20170718 Eclipse 导入外部项目无法识别为web项目并且无法在部署到tomcat下
    zbb20170717Spring4 MVC Hibernate4集成 Annotation maven 各种版本
    zbb20170630 web项目发布至tomcat的ROOT下方法(开发环境和部署环境)
    3.语句的增删改查
    1、java面试
  • 原文地址:https://www.cnblogs.com/songgj/p/9119871.html
Copyright © 2011-2022 走看看