nginx反代流量
🧥

nginx反代流量

Created
May 23, 2021 06:19 AM
Tags
杂项
codeforces
Author
前提:编译安装nginx
# user  nobody;
worker_processes  1;

pid        logs/nginx.pid;

events {
    worker_connections  1024;
}

http {
    include       mime.types;
    default_type  application/octet-stream;
    #access_log  logs/access.log  main;

    sendfile        on;
    #tcp_nopush     on;

    #keepalive_timeout  0;
    keepalive_timeout  65;

    #gzip  on;

    server {
	        listen       80;
				# 80端口重定向
						return 301 https://$host$request_uri;
    }

}

stream {
  log_format proxy '$proxy_protocol_addr $remote_addr [$time_local] '
    '$protocol $status $bytes_sent $bytes_received '
    '$session_time "$upstream_addr" "$ssl_preread_server_name" '
    '"$upstream_bytes_sent" "$upstream_bytes_received" "$upstream_connect_time"';

  access_log /usr/logs/access.log proxy;
  error_log /usr/logs/error.log info;

  map_hash_bucket_size 64;

	map $ssl_preread_server_name $backend_pool {
	codeforces.live server_cf;

	  }
	  upstream server_cf {
		 server codeforces.live:443;
	  }


  server{
    listen 443;
    ssl_preread on;
    proxy_pass $backend_pool;
    proxy_connect_timeout 15s;
    proxy_timeout 15s;
    proxy_next_upstream_timeout 15s;
  }
}
 

Loading Comments...