下面是一段nginx以HTTP形式的反向代理代码
# 编辑nginx.conf文件添加如下代码 upstream http_ziyuan_xueceping_server_pool { server 192.168.0.102:92 weight=1 max_fails=2 fail_timeout=60s down; # 代理到102:92 server 192.168.0.103:92 weight=1 max_fails=2 fail_timeout=60s; # 代理到103:92 } server { listen 80; server_name ziyuan.xueceping.cn; access_log logs/www.ziyuan_xueceping93.log main; error_log logs/www.ziyuan_xueceping93_error.log; #location / { # # host and port to fastcgi server # #uwsgi_pass 127.0.0.1:6688; # socket形式 # include uwsgi_params; # uwsgi_pass uwsgi_ziyuan_xueceping_server_pool; # } location / { #proxy_cache cache_one; #proxy_cache_valid 200 304 10m; #proxy_cache_valid 301 302 1m; #proxy_cache_valid any 1m; proxy_cache_key $host$uri$is_args$args; proxy_set_header Host $host; proxy_set_header X-Forwarded-For $remote_addr; proxy_pass http://http_ziyuan_xueceping_server_pool; # 设置http代理 #expires 1d; } }
.
时间: 2024-11-04 08:10:48