zoukankan      html  css  js  c++  java
  • nginx常用命令及nginx.conf基本配置

    进入nginx安装目录后执行命令!

    1、启动:start nginx 默认是根据nginx.conf来启动的。
    如果要指定配置文件来启动则使用以下命令即可:nginx -c ./conf/jason.conf
    2、关闭:nginx -s stop 快速关闭nginx服务。
    nginx -s quit 优雅的关闭,优雅是指当一个请求被处理完成之后才被关闭。

    在linux下进行关闭nginx:

    1、优雅关闭
    先找出nginx的进程号:`ps -ef|grep nginx
    执行命令:kill -QUIT pid
    2、快速关闭
    也是要先找出nginx的进程号,然后执行kill -TERM pid

    3、 nginx -t 检查配置是否有错误

    4、nginx -s reload  刷新nginx配置文件

    5、nginx.conf基本配置

    http {
    include mime.types;
    default_type application/octet-stream;

    log_format main '$remote_addr - $remote_user [$time_local] "$request" '
    '$status $body_bytes_sent "$http_referer" '
    '"$http_user_agent" "$http_x_forwarded_for"';

    #access_log logs/access.log main;

    sendfile on;
    #tcp_nopush on;

    #keepalive_timeout 0;
    keepalive_timeout 65;

    #gzip on;

    server {
    listen 80;
    server_name localhost;

    #charset koi8-r;

    #access_log logs/host.access.log main;
    #设备pc端webapi
    location /EQUIPMENT_API/ {
    proxy_pass http://127.0.0.1:8072/EQUIPMENT_API/;
    }
    #设备pc端前端
    location /dist/ {
    proxy_pass http://127.0.0.1:8072/;
    }
    #设备pc端访问手机端附件图片静态文件
    location /EQUIPMENT_API/BusinessCheckFile/ {
    alias "E:/IIS/AppWebApiPublish/UploadFiles/BusinessCheckFile/";
    }
    #手机端webapi
    location /Equipment_App_Api/ {
    proxy_pass http://127.0.0.1:8070/;
    }

  • 相关阅读:
    [MySQL] InnoDB三大特性之 插入缓冲
    字节对齐《c和指针》笔记包含位域结构体的内存对齐(32bit,GCC)
    反编译想到的代码安全问题
    剪切\编辑歌曲软件
    照片行【生活随笔】井冈山之行
    埃里克食品浅谈垃圾食品
    C++ 堆排序实现
    SQLite数据库
    全光网络的前世今生
    hdu1201(从出生长18岁经过多少天)
  • 原文地址:https://www.cnblogs.com/zhang-wenbin/p/13685205.html
Copyright © 2011-2022 走看看