zoukankan      html  css  js  c++  java
  • Nginx相关

    (内容有摘抄,如侵权,联系删除,谢谢)

    1、安装nginx

    2、启动:

    #启动nginx
    $/usr/local/nginx/sbin/nginx -c /usr/local/nginx/conf/nginx.conf
    #查看nginx的运行情况
    $ps -ef | grep nginx
    $netstat -tunlp | grep 8000
    -t (tcp) 仅显示tcp相关选项
    -u (udp)仅显示udp相关选项
    -n 拒绝显示别名,能显示数字的全部转化为数字
    -l 仅列出在Listen(监听)的服务状态
    -p 显示建立相关链接的程序名

    3、停止操作

    #查询nginx主进程号
    $ps -ef | grep nginx
    #从容停止Nginx:
    $kill -QUIT 主进程号  
    #例如:kill -QUIT 16391
    
    #快速停止Nginx:
    $kill -TERM 主进程号  
    
    #强制停止Nginx:
    $kill -9 主进程号  
    #kill -HUP 住进称号或进程号文件路径  或者使用
    $/usr/nginx/sbin/nginx -s reload  
    
    nginx -t -c /usr/nginx/conf/nginx.conf 
    或者
    /usr/nginx/sbin/nginx -t 

    4、conf/nignx.conf相关配置

    #user  nobody;
    worker_processes  1;
    
    #error_log  logs/error.log;
    #error_log  logs/error.log  notice;
    #error_log  logs/error.log  info;
    
    #pid        logs/nginx.pid;
    
    
    events {
        worker_connections  1024;
    }
    
    
    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 (域名);
            index index.html index.htm index.shtml;
            location / {
                proxy_pass http://(下面upstream对应名称);
                proxy_set_header X-real-ip $remote_addr;
                proxy_set_header Host $http_host;
            }
            #access_log  /data/wwwlogs/access_op.report.bitauto.com.log  access;
        }
    
        upstream 名称{
            server (ip):8101;
        }
    }
  • 相关阅读:
    golang fmt用法举例
    golang init函数
    golang 定时器
    golang 如何判断变量的类型
    题目:IO多路复用版FTP
    Python模块——gevent 在协程学习中遇到的模块
    python入门三十二天——协程 异步IO数据库队列缓存
    java——第一天 变量,java的基础类型
    操作PPT模块 python-pptx
    python入门三十一天---多进程
  • 原文地址:https://www.cnblogs.com/wu-fm/p/9084831.html
Copyright © 2011-2022 走看看