Getting Real IP For nginx & Blocking IP on HAProxy

Getting Real IP For nginx & Blocking IP on HAProxy
· ·

In Tech in Asia, we are using HAProxy as our load balancer and the request is passed on to either of the two web servers running on nginx to process the request. Because the request always comes from the load balancer, under the access logs, the IP will always be the load balancer IP.

Our HAProxy uses the setting option forwardfor which will forward the original client’s IP under the “X-Forwarded-For” header.

lesterchan.net on nginx/php-fpm & MariaDB

lesterchan.net on nginx/php-fpm & MariaDB
· ·

Previously, lesterchan.net averages about 1,900ms in response time according to Pingdom Public Status Page. When I switched over to HTTPS, the response time increased to 2,600ms. I was still on Apache 2.4.7 running PHP 5.5.9 via mod_php.

When I made the switch to nginx 1.6.2 running PHP 5.5.22 via php-fpm, the response time decreases back to 1,900ms.