在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
环境搭建参考地址:http://www.cnblogs.com/cp-miao/p/7505910.html cp.lua local res1, res2, action action = ngx.var.request_method if action == "POST" then arry = {method = ngx.HTTP_POST, body = ngx.req.read_body()} else arry = {method = ngx.HTTP_GET} end if ngx.var.svr == "on" then res1, res2 = ngx.location.capture_multi { { "/copynode" .. ngx.var.request_uri , arry}, } else ngx.exec("@hubnode") end ngx.exec("@hubnode")
cp.conf upstream hubnode { server 127.0.0.1:3001 weight=1; } upstream cpnode { server 127.0.0.1:9031; } server { listen 443; server_name aa.cn; ssl on; ssl_certificate /etc/ssl/private/all_a.pem; ssl_certificate_key /etc/ssl/private/all_a.pem; location ~* ^/copynode { log_subrequest on; rewrite ^/copynode(.*)$ $1 break; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_pass http://cpnode; #access_log logs/test-upstream.log main; } location @hubnode{ proxy_pass http://hubnode; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-Proto $scheme; } location / { client_body_buffer_size 2m; set $svr "on"; #开启或关闭copy功能 content_by_lua_file "/nas/config/tengine/lua/t.lua"; } access_log /var/log/tengine/np.log access; }
|
请发表评论