zoukankan      html  css  js  c++  java
  • Nginx 命令

    1. 启动 Nginx          /usr/local/nginx/sbin/nginx

    poechant@ubuntu:sudo ./sbin/nginx

    2. 停止 Nginx

    poechant@ubuntu:sudo ./sbin/nginx -s stop
    poechant@ubuntu:sudo ./sbin/nginx -s quit

    -s都是采用向 Nginx 发送信号的方式。
    3. Nginx 重载配置

    poechant@ubuntu:sudo ./sbin/nginx -s reload

    上述是采用向 Nginx 发送信号的方式,或者使用:

    poechant@ubuntu:service nginx reload

    4. 指定配置文件

    poechant@ubuntu:sudo ./sbin/nginx -c /usr/local/nginx/conf/nginx.conf

    -c表示configuration,指定配置文件。
    5. 查看 Nginx 版本

    有两种可以查看 Nginx 的版本信息的参数。第一种如下:

    poechant@ubuntu:/usr/local/nginx$ ./sbin/nginx -v
    nginx: nginx version: nginx/1.0.0

    另一种显示的是详细的版本信息:

    poechant@ubuntu:/usr/local/nginx$ ./sbin/nginx -V
    nginx: nginx version: nginx/1.0.0
    nginx: built by gcc 4.3.3 (Ubuntu 4.3.3-5ubuntu4)
    nginx: TLS SNI support enabled
    nginx: configure arguments: --with-http_ssl_module --with-openssl=/home/luming/openssl-1.0.0d/

    6. 检查配置文件是否正确

    poechant@ubuntu:/usr/local/nginx$ ./sbin/nginx -t
    nginx: [alert] could not open error log file: open() "/usr/local/nginx/logs/error.log" failed (13: Permission denied)
    nginx: the configuration file /usr/local/nginx/conf/nginx.conf syntax is ok
    2012/01/09 16:45:09 [emerg] 23898#0: open() "/usr/local/nginx/logs/nginx.pid" failed (13: Permission denied)
    nginx: configuration file /usr/local/nginx/conf/nginx.conf test failed

    如果出现如上的提示信息,表示没有访问错误日志文件和进程,可以sudo(super user do)一下:

    poerchant@ubuntu:/usr/local/nginx$ sudo ./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

    如果显示如上,则表示配置文件正确。否则,会有相关提示。
    7. 显示帮助信息

    poechant@ubuntu:/user/local/nginx$ ./sbin/nginx -h

    或者:

    poechant@ubuntu:/user/local/nginx$ ./sbin/nginx -?

     

     

    [root@centos-1-22 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@centos-1-22 sbin]# ./nginx -h
    nginx version: nginx/1.0.15
    Usage: nginx [-?hvVtq] [-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
      -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

  • 相关阅读:
    转载文章:用.NET开发MSN聊天机器人 MSN聊天机器人开发揭秘
    ppc全屏程序(转)
    表设计中遇到的多对多的关系解决方案 (zt)
    using ZedGraph
    DataTable.Select(expression)
    你认识它吗?什么是QR码?
    分享《Windows Mobile平台应用与开发》源代码
    收藏信息
    六世喇嘛仓央嘉措诗集
    使用Axis开发Web Service程序
  • 原文地址:https://www.cnblogs.com/zgaspnet/p/4989625.html
Copyright © 2011-2022 走看看