PROXY_STRING + single space + INET_PROTOCOL + single space + CLIENT_IP + single space + PROXY_IP + single space + CLIENT_PORT + single space + PROXY_PORT + "\r\n"
PROXY TCP4 198.51.100.22 203.0.113.7 35646 80\r\n
# sudo apt-get install python-pip # sudo pip install awscli
# sudo vi ~/.aws/config
[default] aws_access_key_id = YOU_ACCESS_ID aws_secret_access_key = YOU_SECRET_ID output = json OR bson OR text region = PREFERRED_AWS_REGION
# aws elb describe-load-balancer-policy-types
{
"PolicyTypeDescriptions": [
...
{
"PolicyAttributeTypeDescriptions": [
{
"Cardinality": "ONE",
"AttributeName": "ProxyProtocol",
"AttributeType": "Boolean"
}
],
"PolicyTypeName": "ProxyProtocolPolicyType",
"Description": "Policy that controls whether to include the IP address and port of the originating
request for TCP messages. This policy operates on TCP/SSL listeners only"
},
...
]
}
# aws elb create-load-balancer-policy --load-balancer-name YOU_ELB_NAME --policy-name EnableProxyProtocol --policy-type-name ProxyProtocolPolicyType --policy-attributes AttributeName=ProxyProtocol,AttributeValue=True
# aws elb set-load-balancer-policies-for-backend-server --load-balancer-name YOU_ELB_NAME --instance-port 80 --policy-names EnableProxyProtocol # aws elb set-load-balancer-policies-for-backend-server --load-balancer-name YOU_ELB_NAME --instance-port 81 --policy-names EnableProxyProtocol # aws elb set-load-balancer-policies-for-backend-server --load-balancer-name YOU_ELB_NAME --instance-port 443 --policy-names EnableProxyProtocol
# aws elb describe-load-balancers --load-balancer-name YOU_ELB_NAME | jq '.LoadBalancerDescriptions[].BackendServerDescriptions'
[
{
"PolicyNames": [
"EnableProxyProtocol"
],
"InstancePort": 80
},
{
"PolicyNames": [
"EnableProxyProtocol"
],
"InstancePort": 81
},
{
"PolicyNames": [
"EnableProxyProtocol"
],
"InstancePort": 443
}
]
# aws elb set-load-balancer-policies-for-backend-server --load-balancer-name YOU_ELB_NAME --instance-port 80 --policy-names "[]"
set_real_ip_from 127.0.0.1;
set_real_ip_from 10.0.0.0/8;
real_ip_header proxy_protocol;
real_ip_recursive on;
server {
listen 80 proxy_protocol;
listen 443 proxy_protocol ssl;
...
location / {
proxy_set_header Host $host;
proxy_set_header X-Real-IP $proxy_protocol_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto tcp;
proxy_set_header X-NginX-Proxy true;
...
}
set_real_ip_from 127.0.0.1;
set_real_ip_from 10.0.0.0/8;
real_ip_header proxy_protocol;
real_ip_recursive on;
server {
listen 80 proxy_protocol;
listen 443 proxy_protocol ssl;
...
location / {
proxy_set_header Host $host;
proxy_set_header X-Real-IP $proxy_protocol_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto tcp;
proxy_set_header X-NginX-Proxy true;
...
}
log_format elb_log '$proxy_protocol_addr - $remote_user [$time_local] ' '"$request" $status $body_bytes_sent "$http_referer" ' '"$http_user_agent"'; set_real_ip_from 172.31.0.0/20; set_real_ip_from 10.0.0.0/8; real_ip_header proxy_protocol;
机械节能产品生产企业官网模板...
大气智能家居家具装修装饰类企业通用网站模板...
礼品公司网站模板
宽屏简约大气婚纱摄影影楼模板...
蓝白WAP手机综合医院类整站源码(独立后台)...苏ICP备2024110244号-2 苏公网安备32050702011978号 增值电信业务经营许可证编号:苏B2-20251499 | Copyright 2018 - 2025 源码网商城 (www.ymwmall.com) 版权所有