标签:hue msdn gsl mdcm psk fbv info 代理 form
Nginx实现反向代理
openresty-nginx增强版(现在使用的)
localhost 反向代理到 s102--s104
#使用指定用户 #user root; #使用的处理器进程数 worker_processes 4; #错误日志文件 #error_log logs/error.log; #日志文件与日志级别 #error_log logs/error.log notice; #error_log logs/error.log info; #存放进程pid #pid /tmp/nginx.pid; events { #每个worker最大连接数 worker_connections 1024; } http { include mime.types; #default_type application/json; #default_type application/octet-stream; #文件类型:纯文本 default_type text/plain; #重点:日志格式 log_format main escape=json $msec#$clientRealIp#$http_client_time#$status#$request_body; #log_format main escape=json $clientRealIp#$http_client_time#$time_local#$status#$request_body; #自定义变量,取得ip串中的第一个ip,也就是用户ip map $http_x_forwarded_for $clientRealIp { ~^(?P<firstAddr>[0-9\.]+),?.*$ $firstAddr; } #反向代理服务器不需要存储日志 access_log off; sendfile on; #tcp_nopush on; underscores_in_headers on; #keepalive_timeout 0; keepalive_timeout 65; #gzip on; #反向代理服务器:静态服务器 upstream nginx_servers{ server s102:8089 max_fails=2 fail_timeout=2 weight=4; server s103:8089 max_fails=2 fail_timeout=2 weight=4; server s104:8089 max_fails=2 fail_timeout=2 weight=4; } #server域配置 server { listen 8089; server_name localhost; charset utf-8; access_log off; location ~* \.(png|html|js|css)$ { proxy_pass http://nginx_servers; } location / { proxy_pass http://nginx_servers; } proxy_set_header Host $host; proxy_set_header remove_user_ip $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; } }
2. linux下
user root; worker_processes 4; #pid /tmp/nginx.pid; events { worker_connections 1024; } http { include mime.types; #default_type application/json; #default_type application/octet-stream; default_type text/plain; log_format main escape=json $msec#$clientRealIp#$http_client_time#$status#$request_body; #log_format main escape=json $clientRealIp#$http_client_time#$time_local#$status#$request_body; map $http_x_forwarded_for $clientRealIp { ~^(?P<firstAddr>[0-9\.]+),?.*$ $firstAddr; } access_log off; sendfile on; #tcp_nopush on; underscores_in_headers on; #keepalive_timeout 0; keepalive_timeout 65; #gzip on; server { listen 8089; server_name s102; charset utf-8; access_log /usr/local/openresty/nginx/logs/access.log main; location / { root html; index index.html index.htm; error_page 405 =200 $1; lua_need_request_body on; content_by_lua ‘local s = ngx.var.request_body‘; } } }
标签:hue msdn gsl mdcm psk fbv info 代理 form
原文地址:https://www.cnblogs.com/star521/p/9865322.html