zoukankan      html  css  js  c++  java
  • nginx 4层代理

    		 
    nginx 配置4层代理:
    
    user www www;
    worker_processes auto;
    
    error_log /usr/local/nginx/logs/error_nginx.log crit;
    pid /var/run/nginx.pid;
    worker_rlimit_nofile 51200;
    
    events {
    use epoll;
    worker_connections 51200;
    multi_accept on;
    }
    
    stream {
    
    server {
    listen 3306;
    proxy_pass Mysql_write;
    }
    
    server {
    listen 3307;
    proxy_pass Mysql_read;
    }
    
    upstream Mysql_write {
    server 192.168.6.19:3306 weight=10;
    server 192.168.6.20:3306 weight=10;
    server 192.168.6.18:3306 weight=10;
    }
    upstream Mysql_read {
    server 192.168.6.175:3306 weight=10;
    server 192.168.6.176:3306 weight=10;
    server 192.168.6.177:3306 weight=10;
    }
    
    }
    http {
    include mime.types;
    default_type application/octet-stream;
    server_names_hash_bucket_size 128;
    client_header_buffer_size 32k;
    large_client_header_buffers 4 32k;
    client_max_body_size 1024m;
    client_body_buffer_size 10m;
    sendfile on;
    tcp_nopush on;
    keepalive_timeout 120;
    server_tokens off;
    tcp_nodelay on;
    
    fastcgi_connect_timeout 300;
    fastcgi_send_timeout 300;
    fastcgi_read_timeout 300;
    fastcgi_buffer_size 64k;
    fastcgi_buffers 4 64k;
    fastcgi_busy_buffers_size 128k;
    fastcgi_temp_file_write_size 128k;
    fastcgi_intercept_errors on;
    
    gzip on;
    gzip_buffers 16 8k;
    gzip_comp_level 6;
    gzip_http_version 1.1;
    gzip_min_length 256;
    gzip_proxied any;
    gzip_vary on;
    gzip_types
    text/xml application/xml application/atom+xml application/rss+xml application/xhtml+xml image/svg+xml
    text/javascript application/javascript application/x-javascript
    text/x-json application/json application/x-web-app-manifest+json
    text/css text/plain text/x-component
    font/opentype application/x-font-ttf application/vnd.ms-fontobject
    image/x-icon;
    gzip_disable “MSIE [1-6].(?!.*SV1)”;
    
    open_file_cache max=1000 inactive=20s;
    open_file_cache_valid 30s;
    open_file_cache_min_uses 2;
    open_file_cache_errors on;
    ########################## vhost
    include vhost/*.conf;
    }
    
    
    
    node1:/etc/nginx#cat nginx.conf
    user nginx nginx;
    worker_processes auto;
    
    error_log /usr/local/nginx/logs/error_nginx.log crit;
    pid /var/run/nginx.pid;
    worker_rlimit_nofile 51200;
    
    events {
    use epoll;
    worker_connections 51200;
    multi_accept on;
    }
    
    stream {
    
    server {
    listen 8080;
    proxy_pass test_8080;
    }
    
    
    upstream test_8080 {
    server 192.168.137.3:9000 weight=10;
    server 192.168.137.3:80 weight=10;
    }
    
    }
    http {
    include mime.types;
    default_type application/octet-stream;
    server_names_hash_bucket_size 128;
    client_header_buffer_size 32k;
    large_client_header_buffers 4 32k;
    client_max_body_size 1024m;
    client_body_buffer_size 10m;
    sendfile on;
    tcp_nopush on;
    keepalive_timeout 120;
    server_tokens off;
    tcp_nodelay on;
    
    fastcgi_connect_timeout 300;
    fastcgi_send_timeout 300;
    fastcgi_read_timeout 300;
    fastcgi_buffer_size 64k;
    fastcgi_buffers 4 64k;
    fastcgi_busy_buffers_size 128k;
    fastcgi_temp_file_write_size 128k;
    fastcgi_intercept_errors on;
    
    gzip on;
    gzip_buffers 16 8k;
    gzip_comp_level 6;
    gzip_http_version 1.1;
    gzip_min_length 256;
    gzip_proxied any;
    gzip_vary on;
    gzip_types
    text/xml application/xml application/atom+xml application/rss+xml application/xhtml+xml image/svg+xml
    text/javascript application/javascript application/x-javascript
    text/x-json application/json application/x-web-app-manifest+json
    text/css text/plain text/x-component
    font/opentype application/x-font-ttf application/vnd.ms-fontobject
    image/x-icon;
    gzip_disable “MSIE [1-6].(?!.*SV1)”;
    
    open_file_cache max=1000 inactive=20s;
    open_file_cache_valid 30s;
    open_file_cache_min_uses 2;
    open_file_cache_errors on;
    ########################## vhost
    include vhost/*.conf;
    }
    
    node1:/root/nginx-1.17.9#./configure --prefix=/usr/local/nginx --with-http_stub_status_module --with-http_ssl_module --with-stream
    
     
     
  • 相关阅读:
    IOE是软件时代或是“买计算机”时代的产物;而云计算时代,则是“买计算”的时代。从本质上来说,“去IOE”是一个企业从传统企业向互联网企业转型的标志。
    物联网听起来像是一个和互联网不同的网,"万物互联"又把"网"给弄丢了,正向我们扑面而来的是"万物互联网"。
    移动互联网真正带来的影响,是使人们的大部分时间都消耗在在线社会上了。
    中国剩余定理
    HDU-1013九余数定理
    HDU--1213并查集
    HDU--1232畅通工程
    并查集
    简单的快速幂取模
    线段树
  • 原文地址:https://www.cnblogs.com/hzcya1995/p/13348420.html
Copyright © 2011-2022 走看看