This code allows me to password protect a site and only allow it to be accessed either by supplying the correct password defined in your.pwd OR if it is called by PayPal. that's the code I had to use for on the staging environment on one of my products (MiniAds).

[code]
location / {
satisfy any;

allow 192.168.1.0/32;

# PayPal servers ; 2014-10-21
allow 66.211.170.66;
allow 216.113.188.202;
allow 216.113.188.203;
allow 216.113.188.204;

deny  all;

auth_basic  "Restricted";
auth_basic_user_file  /var/www/pwd/your.pwd;

index  index.php index.html index.htm;
try_files $uri $uri/ /index.php?$args;
}
[/code]

test
nginx -t

Rreload configuration
nginx -s reload

 

Related: https://www.paypal-community.com/t5/Merchant-services-Archive/IPN-server-s-ip-s/td-p/126274

Referral Note: When you purchase through a referral link (if any) on this page, we may earn a commission.
If you're feeling thankful, you can buy me a coffee or a beer