markhilton / docker-nginx-pagespeed

Nginx Docker Image with PageSpeed, GeoIP and more...
31 stars 22 forks source link
docker geoip nginx pagespeed

Docker Nginx + PageSpeed + GEO IP

This docker image based on Debian Stretch linux distribution. Project goal is an easy to build docker image of latest Nginx web server with Google PageSpeed and Geo IP modules.

PageSpeed

The PageSpeed tools analyze and optimize your site following web best practices. If turned ON it exposes a PageSpeed admin status page at:

VTS

The VTS Nginx virtual host traffic status module. It exposes a status page at:

GeoIP

The GeoIP databases to help decode remote IP address into geographical location.

Important: Due to data privacy regulations, MaxMind made changes to how you can access free GeoLite2 databases. Since database files cannot be accessed by a public URL, you will have to download them manually.

More Headers

The more_set_headersallows to set more HTTP response headers - useful in multi cluster environments.

Substitutions Filter

The subs_filter allows nginx to filter which can do both regular expression and fixed string substitutions on response bodies.

Json access log

Container will produce web server access log through docker /stdout in json format for easy parsing via 3rd party containers like Fluentd.

Main features

Include environment variables to turn ON | OFF Page Speed optimization features for:

as well as:

Nginx is configured by default for high performance, multi cluster production environment, but can be easily adjusted with environment variables.

Configuration

Example docker-compose.yml uses default environment variables:

MAKE_J=4
NGINX_VERSION=1.13.3
PAGESPEED_VERSION=1.12.34.2
LIBPNG_VERSION=1.6.29

### add path to include extra configuration files : (default: off)
NGINX_INCLUDE_PATH=/app/config/nginx/*.conf

### Include default server definition with health check: on|off (default: on)
NGINX_DEFAULT_SERVER=on

### Configure GeoIP support and include extra common fastcgi PHP GeoIP variables: on|off (default: off)
### Deprecated: `NGINX_FASTCGI_GEOIP` variable
NGINX_GEOIP=on

### Google PageSpeed algorithm: on|off (default: off)
NGINX_PAGESPEED=on

### PageSpeed image optimization: on|off (default: off)
NGINX_PAGESPEED_IMG=on

### PageSpeed javascripts optimization: on|off (default: off)
NGINX_PAGESPEED_JS=on

### PageSpeed style sheets optimization: on|off (default: off)
NGINX_PAGESPEED_CSS=on

### PageSpeed cache storage: files|redis|memcached (default: files)
NGINX_PAGESPEED_STORAGE=files

### PageSpeed Redis cache storage address and port: redis.host:port (default: none)
NGINX_PAGESPEED_REDIS=redis.host:6379

### PageSpeed Memcached cache storage address and port: memcached.host:port (default: none)
NGINX_PAGESPEED_MEMCACHED=memcached.host:11211