zoukankan      html  css  js  c++  java
  • Nginx *基本框架

    全局配置指令:
    user nginx;

    模块配置段
    # 事件驱动模块,提供并发响应功能
    events{
    ......
    }
    # http模块,提供web请求处理,可嵌套其他重要模块
    http{
    .......#server{}
    }

    开始配置:#备份nginx.conf ,清空文件
    # vim /etc/hosts 增加主机记录
    vim /etc/nginx/nginx.conf

    worker_processes 2; # 两个nginx进程
    events {
    worker_connections 1024; # 可同时处理1024个http请求
    }

    http {
    include mime.types; #调用mime ,可以处理多媒体
    default_type application/octet-stream;

    upstream test {
    # ip_hash; # 基于客户端的hash值进行请求分配
    server test1.com weight=10; # 权重负载
    server test2.com weight=20;
    }

    server {
    listen 80;
    server_name afan.com; # 用户输入网页先匹配到server{}中
    location / {
    proxy_pass http://test/index.html; # 扔给后端服务器,
    # html 是upstream的引用,先扔给 upstream html{}模块
    }
    }

    #############################################3
    server { #nginx至少有个虚拟主机才能工作
    listen 80;
    server_name Localhost; # 虚拟主机名称
    access_log /var/log/nginx/access_html.log html_log; #若localtion中,优先
    root html; # 网站主目录 ,一般是配置文件所在的目录

    location{}

    }
    }

    # 压力测试:# while true; do curl afan.com;done
    # shell : for i in `seq 1 20` ;do
    curl afan.com
    sleep 0.5
    done

  • 相关阅读:
    异或和之和
    Wannafly挑战赛19C:多彩的树
    HDU 6035 树形dp
    利用C++套接字发送邮件
    洛谷P3368树状模板(区间更新+单点查询+差分)
    CCF 201903-1 小中大
    关于树状数组
    CODEVS 4189 (前缀是否出现)
    关于字典树
    hdu 1022 Train Problem
  • 原文地址:https://www.cnblogs.com/wanzf/p/10654099.html
Copyright © 2011-2022 走看看