We have several load-loaded web servers running the same PHP webapp ( LAMP ), and I would like to run slightly different code on each server (for testing purposes). I was hoping to use super-global $_SERVER['SERVER_ADDR']to do something like this:
if ($_SERVER['SERVER_ADDR'] == 'XXX.XXX.XXX.XXX') {
echo "Do one thing";
} elseif ($_SERVER['SERVER_ADDR'] == 'YYY.YYY.YYY.YYY') {
echo "Do something else";
}
Unfortunately, this does not work because both machines are set $_SERVER['SERVER_ADDR']to 127.0.0.1 . How do I configure them to $_SERVER['SERVER_ADDR']be set to their public IP address?
I assume that the problem may be related /etc/hosts, so for reference, it looks like this:
127.0.0.1 localhost.localdomain localhost
::1 localhost6.localdomain6 localhost6
XXX.XX.XX.XX blahblah
Updating ...
,! nginx -. - nginx - nginx conf:
location / {
root /var/www/staging/current;
proxy_pass http://localhost:8880;
}