【nginx】配置文件(模块、反向代理、负载均衡、动静分离)

第一块:全局模块
worker_processes auto;  值越大支持的并发量就越大
第二块:events模块

events
    {
        worker_connections 51200; nginx与用户的最大连接数
    }
第三大块:

    http模块:
        include       mime.types;  包括的类型
        default_type  application/octet-stream; 默认类型


    server模块 # 一个server 可以配置多个loaction模块
      listen 80;   # 监听端口 
      server_name location; # 监听访问域名;
      index index.html index.htm index.php; # 优先访问页面
      root
/www/server/ # 路径
location模块:

     # 反向代理
     location ~ /aaa/ # 正则匹配
{  
        proxy_pass http://127.0.0.1:8000; # 反向代理转发到服务器IP接收端口8000
      }
     location ~ /bbb/ # 正则匹配
{  
        proxy_pass http://127.0.0.1:8001; # 反向代理转发到服务器IP接收端口8001
      }
     
负载均衡配置

 

动静分离配置(反向代理里面配置):

主攻:Python 数据分析 web 机器学习 图像识别。。 副攻:JAVA WEB 安卓 大数据
原文地址:https://www.cnblogs.com/wanghong1994/p/14806888.html