AWS/ELB

From Ever changing code
< AWS
Revision as of 22:34, 26 March 2019 by Pio2pio (talk | contribs) (Created page with "= Use Nginx to preserve headers/client IP when working with ELB = If you configure ELB for Http/s then headers forwardes but if you decide to use TCP load balancing <source...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Use Nginx to preserve headers/client IP when working with ELB

If you configure ELB for Http/s then headers forwardes but if you decide to use TCP load balancing

sudo apt-get install nginx
systemctl status nginx
tail -f /var/log/nginx/access.log
pip install awscli==1.6.6
aws configure
aws elb describe-load-balancer-policy-types
aws elb create-load-balancer-policy --load-balancer-name linuxacademy-protocol-policy --policy-name "<POLICY NAME>" --policy-type-name ProxyProtocolPolicyType --policy-attributes AttributeName=Proxy Protocol, AttributeValue-true
aws elb describe-load-balancer-policies --load-balancer-name aws "<LOAD BALANCER NAME>"
aws elb set-load-balancer-policies-for-backend-server --load-balancer-name "<LOAD BALANCER NAME>" --instance-port 80 --policy-names linuxacademy-protocol-policy
cd /etc
cd nginx/
vim nginx.conf
systemctl restart nginx