wodby / php

Generic PHP docker container images
MIT License
152 stars 103 forks source link

possibly re-visit decision on #59 geoip removal #65

Closed virtuman closed 5 years ago

virtuman commented 5 years ago

Can't reopen that ticket, so starting the new one regarding the same topic - geoip and appropriate headers for fastcgi and proxy .

Having geoip on nginx is:

  1. Might be faster than having it as the php dependency.
  2. Uses significantly less memory on high traffic sites
  3. Allows to analyze and / or block traffic by country
  4. I imagine it has all the same info available in php module, unfortunately you actually need to peak into the data, to see all available variables, not overly documented: https://github.com/leev/ngx_http_geoip2_module#geoip .. only some sample values listed in the examples: https://github.com/leev/ngx_http_geoip2_module#example-usage
  5. Being able to throttle traffic by country, ie. we want to be open globally, but some asian countries are massive scrapers, and it's beneficial to be able to slow down traffic by country / continent.
  6. Geoip2 is multi-lingual, could be beneficial to some of the other users
  7. Doesn't require installing any of the codebase plugins and is uniformed for all stacks that may be used in the environment

Downside, as you mentioned, recency of the database in the image. Although database update could easily be launched as a background process after container start. There're plenty of other ways to keep database synchronized periodically too

csandanov commented 5 years ago

This nginx image is intended to use behind a reverse proxy (ingress, traefik) which normally already provides geoip feature (ingress-nginx). As for performance, I suggest using our Varnish image for that, that already have geoip module.