Sign inSign up

k44sh/nginx

By k44sh

Updated 16 days ago

Docker of the NGINX web server based on Alpine Linux with PHP and a few modules

Image
Web servers
0

5.3K

k44sh/nginx repository overview

Alpine Linux Build Status Github Stars License

Latest Version Docker Size Docker Pulls

About

NGINX and PHP Docker image based on Alpine Linux.


Features

Modules

ModuleDesctiption
nginx-mod-http-brotliServes compressed responses with brotli (Google)
nginx-mod-http-auth-jwtClient authorization (JSON Web Token (JWT) / OpenID Connect)
nginx-mod-http-cookie-flagSet the flags HttpOnly, secure and SameSite for cookies
nginx-mod-http-dav-extAdditional implementation for full WebDav compatibility
nginx-mod-http-fancyindexLike the built-in autoindex module, but fancier
nginx-mod-http-geoip2City and country code lookups via the MaxMind GeoIP2
nginx-mod-http-headers-moreSet and clear input and output headers
nginx-mod-http-vtsVirtual host and upstream traffic status
nginx-mod-rtmpRTMP protocol support. Live streaming and video on demand
Example
VTS Module

Supported platforms

  • linux/amd64
  • linux/arm64
  • linux/arm/v7

Usage

Docker Compose

Docker compose is the recommended way to run this image.

Edit the compose file with your preferences and run the following command:

git clone https://github.com/k44sh/nginx.git
mkdir -p {config,data}
docker-compose up -d
docker-compose logs -f
Upgrade

To upgrade, pull the newer image and launch the container:

docker-compose pull
docker-compose up -d
Command line

You can also use the following minimal command:

docker run --rm -d --name nginx \
  -p 80:8080/tcp \
  -p 1935:1935 \
  -e TZ="America/Toronto" \
  k44sh/nginx && \
  docker logs -f nginx

Or this one for more customization:

docker run --rm -d --name nginx \
  --ulimit nproc=65535 \
  --ulimit nofile=32000:40000 \
  --memory=2g \
  --cpus=4 \
  -p 80:8000/tcp \
  -p 1935:1935 \
  -e TZ="America/Toronto" \
  -e PORT="8000" \
  -e PUID="1002" \
  -e PGID="1002" \
  -e USER="docker" \
  -e MM_ACCOUNT="XXXXXX" \
  -e MM_LICENSE="xxxxxxxxxxxx" \
  -e MEMORY_LIMIT="1024M" \
  -e UPLOAD_MAX_SIZE="100M" \
  k44sh/nginx && \
  docker logs -f nginx

Environment Variables

VariableDescription
TZThe timezone assigned to the container (default UTC)
PORTNGINX listening port (default 8080)
PUIDNGINX user id (default 1000)
PGIDNGINX group id (default 1000)
USERThe user name assigned to the container (default docker)
GEOIP2_CONFPath to GeoIP2 configuration file (default /etc/geoip2.conf)
GEOIP2_PATHPath to the GeoIP2 data directory (default /geoip2)
MM_ACCOUNTYour MaxMind account ID
MM_LICENSEYour MaxMind license key
MEMORY_LIMITPHP memory limit (default 512M)
UPLOAD_MAX_SIZEUpload max size (default 16M)
CLEAR_ENVClear environment in FPM workers (default yes)
OPCACHE_MEM_SIZEPHP OpCache memory consumption (default 256)
MAX_FILE_UPLOADSThe maximum number of files allowed to be uploaded simultaneously (default 50)
RTMP (Streaming)
  • /var/www/stream/play.php: Internal authentication to add an authentication when publishing a stream
  • /var/www/stream/publish.php: Internal authentication to add authentication to watch a stream
// Accounts
$accounts  =  array(
  0  =>  array(
    "name"  =>  "user1",
    "pass"  =>  "xxxxxxxxxxxxxxxx"
  ),
[...]

You can configure OBS like this:

  • Server Example: rtmp://192.168.1.1/stream
  • Key Example: user1?name=user1&key=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

You can watch a stream like this:

  • Network URL: rtmp://192.168.1.1/stream/user1?name=user1&pass=xxxxxxxxxxxxxxxx

If you want remove authentication, just comment the following directives in nginx.conf:

Documentation: https://github.com/arut/nginx-rtmp-module/wiki/Directives

Tag summary

Content type

Image

Digest

sha256:45fb175e6

Size

134.3 MB

Last updated

16 days ago

docker pull k44sh/nginx