linux-centos-nginx.conf配置负载均衡

  1. #user  nobody;    
  2. worker_processes  1;    
  3.     
  4. #error_log  logs/error.log;    
  5. #error_log  logs/error.log  notice;    
  6. #error_log  logs/error.log  info;    
  7.     
  8. #pid        logs/nginx.pid;    
  9.     
  10. events {    
  11.     worker_connections  1024;    
  12. }    
  13.     
  14. http {    
  15.     include      mime.types;    
  16.     default_type  application/octet-stream;    
  17.     
  18.     #log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '    
  19.     #                  '$status $body_bytes_sent "$http_referer" '    
  20.     #                  '"$http_user_agent" "$http_x_forwarded_for"';    
  21.     
  22.     #access_log  logs/access.log  main;    
  23.     
  24.     sendfile        on;    
  25.     #tcp_nopush    on;    
  26.     
  27.     #keepalive_timeout  0;    
  28.     keepalive_timeout  65;    
  29.     
  30.     #gzip  on;    
  31.     
  32.     #kafka监控  
  33.     server {    
  34.         listen      9921;    #外网端口  
  35.         server_name  kafkaOffsetServer;  #服务名  
  36.     
  37.         #charset koi8-r;    
  38.     
  39.         #access_log  logs/host.access.log  main;    
  40.     
  41.         #location / {    
  42.           #root  html;    
  43.             #index  index.html index.htm;    
  44.         #}    
  45.         location / {    
  46.             proxy_pass http://10.2.20.49:8089;  #端口对应集群服务页面地址  
  47.         }    
  48.     
  49.         #error_page  404              /404.html;    
  50.     
  51.         # redirect server error pages to the static page /50x.html    
  52.         #    
  53.         error_page  500 502 503 504  /50x.html;    
  54.         location = /50x.html {    
  55.             root  html;    
  56.         }    
  57.     }    
  58.     
  59.     #hdfs服务    
  60.     server {    
  61.         listen      9922;    
  62.         server_name  hadoopHdfsServer;    
  63.     
  64.         #charset koi8-r;    
  65.     
  66.         #access_log  logs/host.access.log  main;    
  67.     
  68.         #location / {    
  69.           #root  html;    
  70.             #index  index.html index.htm;    
  71.         #}    
  72.         location / {    
  73.             proxy_pass http://10.2.20.40:50070;    
  74.         }    
  75.     
  76.         #error_page  404              /404.html;    
  77.     
  78.         # redirect server error pages to the static page /50x.html    
  79.         #    
  80.         error_page  500 502 503 504  /50x.html;    
  81.         location = /50x.html {    
  82.             root  html;    
  83.         }    
  84.     }    
  85.       
  86.     #yarn服务  
  87.     server {    
  88.         listen      9923;    #外网端口  
  89.         server_name  yarnServer;  #服务名  
  90.     
  91.         #charset koi8-r;    
  92.     
  93.         #access_log  logs/host.access.log  main;    
  94.     
  95.         #location / {    
  96.           #root  html;    
  97.             #index  index.html index.htm;    
  98.         #}    
  99.         location / {    
  100.             proxy_pass http://10.2.20.39:8088;  #端口对应集群服务页面地址  
  101.         }    
  102.     
  103.         #error_page  404              /404.html;    
  104.     
  105.         # redirect server error pages to the static page /50x.html    
  106.         #    
  107.         error_page  500 502 503 504  /50x.html;    
  108.         location = /50x.html {    
  109.             root  html;    
  110.         }    
  111.     }  
  112.       
  113.     #jobHistory服务  
  114.     server {    
  115.         listen      9924;    #外网端口  
  116.         server_name  jobHistoryServer;  #服务名  
  117.     
  118.         #charset koi8-r;    
  119.     
  120.         #access_log  logs/host.access.log  main;    
  121.     
  122.         #location / {    
  123.           #root  html;    
  124.             #index  index.html index.htm;    
  125.         #}    
  126.         location / {    
  127.             proxy_pass http://10.2.20.41:19888;  #端口对应集群服务页面地址  
  128.         }    
  129.     
  130.         #error_page  404              /404.html;    
  131.     
  132.         # redirect server error pages to the static page /50x.html    
  133.         #    
  134.         error_page  500 502 503 504  /50x.html;    
  135.         location = /50x.html {    
  136.             root  html;    
  137.         }    
  138.     }  
  139.       
  140.     #hue服务  
  141.     server {    
  142.         listen      9925;    #外网端口  
  143.         server_name  hueServer;  #服务名  
  144.     
  145.         #charset koi8-r;    
  146.     
  147.         #access_log  logs/host.access.log  main;    
  148.     
  149.         #location / {    
  150.           #root  html;    
  151.             #index  index.html index.htm;    
  152.         #}    
  153.         location / {    
  154.             proxy_pass http://10.2.20.44:8888;  #端口对应集群服务页面地址  
  155.         }    
  156.     
  157.         #error_page  404              /404.html;    
  158.     
  159.         # redirect server error pages to the static page /50x.html    
  160.         #    
  161.         error_page  500 502 503 504  /50x.html;    
  162.         location = /50x.html {    
  163.             root  html;    
  164.         }    
  165.     }  
  166.       
  167.     #oozie服务  
  168.     server {    
  169.         listen      9926;    #外网端口  
  170.         server_name  oozieServer;  #服务名  
  171.     
  172.         #charset koi8-r;    
  173.     
  174.         #access_log  logs/host.access.log  main;    
  175.     
  176.         #location / {    
  177.           #root  html;    
  178.             #index  index.html index.htm;    
  179.         #}    
  180.         location / {    
  181.             proxy_pass http://10.2.20.69:11000;  #端口对应集群服务页面地址  
  182.         }    
  183.     
  184.         #error_page  404              /404.html;    
  185.     
  186.         # redirect server error pages to the static page /50x.html    
  187.         #    
  188.         error_page  500 502 503 504  /50x.html;    
  189.         location = /50x.html {    
  190.             root  html;    
  191.         }    
  192.     }  
  193. }  

猜你喜欢

转载自blog.csdn.net/qq_30245135/article/details/80170102