zoukankan      html  css  js  c++  java
  • Nginx小白入门实战

    Nginx启动

    通过配置文件启动,其中-c是配置文件的意思

    /usr/local/nginx/sbin/nginx -c /usr/local/nginx/conf/nginx.conf

    若是将nginx添加到环境变量中,那么直接输入nginx即可启动

    先vim /etc/profile

    然后在文件中写

    PATH=$PATH:/usr/local/nginx/sbin
    export PATH

    如果输入该命令,结果报错,那么可能是端口占用引起的,可以先查看是否已有nginx在运行,有的话就kill掉进程


    启动之后,如何查看运行状态

    ps -ef | grep nginx


    查看之后有两个进程,一个master 一个worker,说明nginx启动好了

    nginx: master process

    nginx: worker process

    其中:

    master进程用来读取配置文件并且维护worker进程

    worker进程用来对请求进行实际处理


    关闭Nginx

    kill -QUIT masterPID  (其中masterPID为主进程的PID,用ps -ef | grep nginx查找) 会执行完当前请求再关闭进程

    重启Nginx 在sbin目录下

    ./nginx -s reload


    配置检查

    nginx -t

    查看版本

    nginx -v 或者 nginx -V,后者更详细些

    查看日志

    cd /usr/local/nginx/logs

    tail access.log

    启动关闭nginx

    systemctl start nginx

    systemctl stop nginx

  • 相关阅读:
    模拟--北京标准时间
    DOM方法
    Document-对象属性和常用的对象方法
    struts2标签
    OGNL
    Java基础方面
    初识拦截器
    访问者模式
    备忘录模式
    门面模式
  • 原文地址:https://www.cnblogs.com/tudoo/p/12521306.html
Copyright © 2011-2022 走看看