资源:
https://files.cnblogs.com/files/abelkeith/openresty-x86_64.zip
安装命令:
yum install *.rpm -y
配置4层和7层代理的模板文件
user nobody nobody; worker_processes 4; events { worker_connections 102400; use epoll; } http { include mime.types; default_type application/octet-stream; real_ip_header X-Forwarded-For; log_format main '$time_local || $remote_addr || $upstream_addr || $status || $host || $request_time || $upstream_status || $upstream_response_time ' ' || $upstream_cache_status || $body_bytes_sent || $http_referer ' ' || $remote_user || $http_user_agent ' ' || $http_x_forwarded_for || $request'; #access_log logs/access.log main; sendfile on; keepalive_timeout 15; server_names_hash_bucket_size 128; tcp_nopush on; tcp_nodelay on; server_tokens off; charset utf8; underscores_in_headers on; proxy_next_upstream off; proxy_read_timeout 300; proxy_send_timeout 300; proxy_buffer_size 16k; proxy_buffers 4 16k; proxy_busy_buffers_size 32k; proxy_temp_file_write_size 32k; proxy_temp_path tmp/proxy_temp; proxy_ignore_client_abort on; client_header_buffer_size 2k; large_client_header_buffers 4 16k; client_max_body_size 200m; gzip on; gzip_min_length 2k; gzip_buffers 4 16k; gzip_comp_level 2; gzip_types text/js image/jpeg image/png text/plain text/css text/javascript; gzip_vary on; gzip_proxied expired no-cache no-store private auth; include vhost/*/*.conf; } stream { log_format proxy '$remote_addr [$time_local]' '$protocol $status $bytes_sent $bytes_received' '$session_time "$upstream_addr" ' '"$upstream_bytes_sent" "$upstream_bytes_received" "$upstream_connect_time"'; access_log /data/wwwlogs/tcp-access.log proxy ; error_log /data/wwwlogs/tcp-error.log warn ; include stream/*/*.conf; }