Sign inSign up

zerolabssyseng/nginx

By zerolabssyseng

•Updated almost 7 years ago

Nginx Container

Image
0

296

zerolabssyseng/nginx repository overview

⁠Nginx Container

⁠Configure Makefile.am
IMAGE = zerolabssyseng/nginx

clean-local:
	docker rmi $(CLEAN_OPTIONS) $(IMAGE):$(TAG) || true

build:
	docker build $(BUILD_OPTIONS) --build-arg TAG=${TAG} -t $(IMAGE):$(TAG) .

pull:
	docker pull $(PULL_OPTIONS) $(IMAGE):$(TAG)

push: build
	docker push $(PUSH_OPTIONS) $(IMAGE):$(TAG)
⁠Running with make
make [options]:
    clean-local
    build
    pull
    push
⁠Dockerfile
ARG TAG

FROM zerolabssyseng/base-consul:${TAG:-latest}
MAINTAINER "System Engineer (SysEng)"

RUN mkdir /var/www && \
    addgroup -g 82 -S www-data && \
    adduser -u 82 -S -D -g "" -G www-data www-data

RUN apk add --update nginx && \
    ln -sf /dev/stdout /var/log/nginx/access.log && \
    ln -sf /dev/stderr /var/log/nginx/error.log && \
    rm -rf /var/cache/apk/*

COPY rootfs/ /

ENTRYPOINT [ "/init" ]
CMD []

EXPOSE 80 443
VOLUME [ "/var/cache/nginx", "/var/www" ]
⁠Docker Compose (Skeleton)
version: '3.5'

volumes:
    nginx:
    www:

services:
    nginx:
        image: zerolabssyseng/nginx:latest
        container_name: zerolabssyseng_nginx
        ports:
            - "80:80"
            - "443:443"
        volumes:
            - /etc/localtime:/etc/localtime:ro
            - nginx:/var/cache/nginx                        # volume for cache
            - www:/var/www                                  # volume for web files
        environment:
            - ENV=local                                     # environment name
            #- NGINX_TEMPLATE=generic                       # configuration template

            #
            # template generic
            #

            #- NGINX_WORKERPROCESSES=1                      # number of worker processes
            #- NGINX_WORKERCONNECTIONS=1024                 # number of connections per worker process
            #- NGINX_WORKERRLIMITNOFILE=2048                # limit of maximum number of open files
            #- NGINX_KEEPALIVETIMEOUT=75s                   # keepalive timeout
            #- NGINX_KEEPALIVEREQUESTS=100                  # maximum requests per connection with keepalive
            #- NGINX_RESETTIMEDOUTCONNECTION=off            # enable resetting timed out connections
            #- NGINX_CLIENTHEADERTIMEOUT=60s                # client header request timeout
            #- NGINX_CLIENTBODYTIMEOUT=60s                  # client body timeout
            #- NGINX_SENDTIMEOUT=60s                        # send timeout
            #- NGINX_CLIENTHEADERBUFFERSIZE=1k              # buffer size for reading client request header
            #- NGINX_LARGECLIENTHEADERBUFFERS=4 8k          # maximum number and size of buffers used for reading large client request header
            #- NGINX_CLIENTBODYBUFFERSIZE=8k                # buffer size for reading client request body
            #- NGINX_CLIENTMAXBODYSIZE=1m                   # maximum allowed size of the client request body
            #- NGINX_ACCESSLOG=0                            # enable access logs
            #- NGINX_INCLUDECONF=0                          # include files from conf.d/ directory
            #- NGINX_REUSEPORT=0                            # enable reuse port
            #- NGINX_SSL=0                                  # enable SSL support
            #- NGINX_SSLHTTP2=0                             # enable HTTP2 support
            #- NGINX_SSLCERTIFICATE=                        # SSL certificate file
            #- NGINX_SSLCERTIFICATEKEY=                     # SSL private key file
            #- NGINX_SSLDHPARAM=/etc/nginx/ssl/dhparam.pem  # SSL diffie-hellman parameters file
            #- NGINX_SSLPROTOCOLS=TLSv1 TLSv1.1 TLSv1.2     # SSL protocols
            #- NGINX_SSLCIPHERS=EECDH+AESGCM:EDH+AESGCM:AES256+EECDH:AES256+EDH # SSL ciphers
            #- NGINX_SSLREDIRECT=0                          # redirect HTTP to HTTPS
            #- NGINX_OPENFILECACHE=1                        # enable open file cache
            #- NGINX_GZIP=1                                 # enable gzip support
            #- NGINX_EXPIRE=1                               # enable expire on static content
            #- NGINX_EXPIREDELAY=1d                         # expire delay of static content
            #- NGINX_EXPIREACCESSLOG=0                      # enable access log for static content
            #- NGINX_STATUS=0                               # enable status page
            #- NGINX_STATUSLOCATION=/nginx_status           # status page location
            #- NGINX_STATUSALLOW=127.0.0.1                  # IP/CIDR allowed to access to status page (comma separated list)
            #- NGINX_SERVERNAME=""                          # server names
            #- NGINX_ROOT=/var/www                          # root directory
            #- NGINX_INDEX=index.html                       # index pages
            #- NGINX_AUTHBASIC=                             # enable basic authentication
            #- NGINX_AUTHBASICUSERFILE=                     # basic authentication user file

            #
            # template fastcgi
            #

            #- NGINX_WORKERPROCESSES=1                      # number of worker processes
            #- NGINX_WORKERCONNECTIONS=1024                 # number of connections per worker process
            #- NGINX_WORKERRLIMITNOFILE=2048                # limit of maximum number of open files
            #- NGINX_KEEPALIVETIMEOUT=75s                   # keepalive timeout
            #- NGINX_KEEPALIVEREQUESTS=100                  # maximum requests per connection with keepalive
            #- NGINX_RESETTIMEDOUTCONNECTION=off            # enable resetting timed out connections
            #- NGINX_CLIENTHEADERTIMEOUT=60s                # client header request timeout
            #- NGINX_CLIENTBODYTIMEOUT=60s                  # client body timeout
            #- NGINX_SENDTIMEOUT=60s                        # send timeout
            #- NGINX_CLIENTHEADERBUFFERSIZE=1k              # buffer size for reading client request header
            #- NGINX_LARGECLIENTHEADERBUFFERS=4 8k          # maximum number and size of buffers used for reading large client request header
            #- NGINX_CLIENTBODYBUFFERSIZE=8k                # buffer size for reading client request body
            #- NGINX_CLIENTMAXBODYSIZE=1m                   # maximum allowed size of the client request body
            #- NGINX_ACCESSLOG=0                            # enable access logs
            #- NGINX_INCLUDECONF=0                          # include files from conf.d/ directory
            #- NGINX_REUSEPORT=0                            # enable reuse port
            #- NGINX_SSL=0                                  # enable SSL support
            #- NGINX_SSLHTTP2=0                             # enable HTTP2 support
            #- NGINX_SSLCERTIFICATE=                        # SSL certificate file
            #- NGINX_SSLCERTIFICATEKEY=                     # SSL private key file
            #- NGINX_SSLDHPARAM=/etc/nginx/ssl/dhparam.pem  # SSL diffie-hellman parameters file
            #- NGINX_SSLPROTOCOLS=TLSv1 TLSv1.1 TLSv1.2     # SSL protocols
            #- NGINX_SSLCIPHERS=EECDH+AESGCM:EDH+AESGCM:AES256+EECDH:AES256+EDH # SSL ciphers
            #- NGINX_SSLREDIRECT=0                          # redirect HTTP to HTTPS
            #- NGINX_OPENFILECACHE=0                        # enable open file cache
            #- NGINX_GZIP=0                                 # enable gzip support
            #- NGINX_EXPIRE=0                               # enable expire on static content
            #- NGINX_EXPIREDELAY=1d                         # expire delay of static content
            #- NGINX_EXPIREACCESSLOG=0                      # enable access log for static content
            #- NGINX_STATUS=0                               # enable status page
            #- NGINX_STATUSLOCATION=/nginx_status           # status page location
            #- NGINX_STATUSALLOW=127.0.0.1                  # IP/CIDR allowed to access to status page (comma separated list)
            #- NGINX_FASTCGISERVERS=fastcgi:9000            # fastcgi backend servers list
            #- NGINX_SERVERNAME=""                          # server names
            #- NGINX_ROOT=/var/www                          # root directory
            #- NGINX_INDEX=index.html index.php             # index pages
            #- NGINX_TRYFILES="$uri/ /index.cgi?$args;"     # try files
            #- NGINX_AUTHBASIC=                             # enable basic authentication
            #- NGINX_AUTHBASICUSERFILE=                     # basic authentication user file
            #- NGINX_UPSTREAMMETHOD=                        # load balancing method (set empty for default round-robin)
            #- NGINX_UPSTREAMKEEPALIVE=0                    # number of upstream minimal keepalive connections
            #- NGINX_UPSTREAMWEIGHT=1                       # weight of the server
            #- NGINX_UPSTREAMMAXCONNS=0                     # maximum connections to upstream server
            #- NGINX_UPSTREAMMAXFAILS=1                     # number of unsuccessful attempts before marking upstream server as unavailable
            #- NGINX_UPSTREAMFAILTIMEOUT=10s                # time before marking upstream server as unavailable and period of unavailability

            #
            # template php
            #

            #- NGINX_WORKERPROCESSES=1                      # number of worker processes
            #- NGINX_WORKERCONNECTIONS=1024                 # number of connections per worker process
            #- NGINX_WORKERRLIMITNOFILE=2048                # limit of maximum number of open files
            #- NGINX_KEEPALIVETIMEOUT=75s                   # keepalive timeout
            #- NGINX_KEEPALIVEREQUESTS=100                  # maximum requests per connection with keepalive
            #- NGINX_RESETTIMEDOUTCONNECTION=off            # enable resetting timed out connections
            #- NGINX_CLIENTHEADERTIMEOUT=60s                # client header request timeout
            #- NGINX_CLIENTBODYTIMEOUT=60s                  # client body timeout
            #- NGINX_SENDTIMEOUT=60s                        # send timeout
            #- NGINX_CLIENTHEADERBUFFERSIZE=1k              # buffer size for reading client request header
            #- NGINX_LARGECLIENTHEADERBUFFERS=4 8k          # maximum number and size of buffers used for reading large client request header
            #- NGINX_CLIENTBODYBUFFERSIZE=8k                # buffer size for reading client request body
            #- NGINX_CLIENTMAXBODYSIZE=1m                   # maximum allowed size of the client request body
            #- NGINX_ACCESSLOG=0                            # enable access logs
            #- NGINX_INCLUDECONF=0                          # include files from conf.d/ directory
            #- NGINX_REUSEPORT=0                            # enable reuse port
            #- NGINX_SSL=0                                  # enable SSL support
            #- NGINX_SSLHTTP2=0                             # enable HTTP2 support
            #- NGINX_SSLCERTIFICATE=                        # SSL certificate file
            #- NGINX_SSLCERTIFICATEKEY=                     # SSL private key file
            #- NGINX_SSLDHPARAM=/etc/nginx/ssl/dhparam.pem  # SSL diffie-hellman parameters file
            #- NGINX_SSLPROTOCOLS=TLSv1 TLSv1.1 TLSv1.2     # SSL protocols
            #- NGINX_SSLCIPHERS=EECDH+AESGCM:EDH+AESGCM:AES256+EECDH:AES256+EDH # SSL ciphers
            #- NGINX_SSLREDIRECT=0                          # redirect HTTP to HTTPS
            #- NGINX_OPENFILECACHE=0                        # enable open file cache
            #- NGINX_GZIP=0                                 # enable gzip support
            #- NGINX_EXPIRE=0                               # enable expire on static content
            #- NGINX_EXPIREDELAY=1d                         # expire delay of static content
            #- NGINX_EXPIREACCESSLOG=0                      # enable access log for static content
            #- NGINX_STATUS=0                               # enable status page
            #- NGINX_STATUSLOCATION=/nginx_status           # status page location
            #- NGINX_STATUSALLOW=127.0.0.1                  # IP/CIDR allowed to access to status page (comma separated list)
            #- NGINX_PHPSERVERS=php:9000                    # PHP backend servers list
            #- NGINX_SERVERNAME=""                          # server names
            #- NGINX_ROOT=/var/www                          # root directory
            #- NGINX_INDEX=index.html index.php             # index pages
            #- NGINX_TRYFILES="$uri/ /index.php?$args;"     # try files
            #- NGINX_AUTHBASIC=                             # enable basic authentication
            #- NGINX_AUTHBASICUSERFILE=                     # basic authentication user file
            #- NGINX_PHPSTATUS=0                            # php status page
            #- NGINX_PHPSTATUSLOCATION=/php-fpm_status      # php status page location
            #- NGINX_PHPSTATUSALLOW=127.0.0.1               # IP/CIDR allowed to access to php status page (comma separated list)
            #- NGINX_PHPSTATUSPING=0                        # php ping page
            #- NGINX_PHPSTATUSPINGLOCATION=/php-fpm_ping    # php ping page location
            #- NGINX_PHPSTATUSPINGALLOW=127.0.0.1           # IP/CIDR allowed to access to php ping page (comma separated list)
            #- NGINX_UPSTREAMMETHOD=                        # load balancing method (set empty for default round-robin)
            #- NGINX_UPSTREAMKEEPALIVE=0                    # number of upstream minimal keepalive connections
            #- NGINX_UPSTREAMWEIGHT=1                       # weight of the server
            #- NGINX_UPSTREAMMAXCONNS=0                     # maximum connections to upstream server
            #- NGINX_UPSTREAMMAXFAILS=1                     # number of unsuccessful attempts before marking upstream server as unavailable
            #- NGINX_UPSTREAMFAILTIMEOUT=10s                # time before marking upstream server as unavailable and period of unavailability

            #
            # template proxy
            #

            #- NGINX_WORKERPROCESSES=1                      # number of worker processes
            #- NGINX_WORKERCONNECTIONS=1024                 # number of connections per worker process
            #- NGINX_WORKERRLIMITNOFILE=2048                # limit of maximum number of open files
            #- NGINX_KEEPALIVETIMEOUT=75s                   # keepalive timeout
            #- NGINX_KEEPALIVEREQUESTS=100                  # maximum requests per connection with keepalive
            #- NGINX_RESETTIMEDOUTCONNECTION=off            # enable resetting timed out connections
            #- NGINX_CLIENTHEADERTIMEOUT=60s                # client header request timeout
            #- NGINX_CLIENTBODYTIMEOUT=60s                  # client body timeout
            #- NGINX_SENDTIMEOUT=60s                        # send timeout
            #- NGINX_CLIENTHEADERBUFFERSIZE=1k              # buffer size for reading client request header
            #- NGINX_LARGECLIENTHEADERBUFFERS=4 8k          # maximum number and size of buffers used for reading large client request header
            #- NGINX_CLIENTBODYBUFFERSIZE=8k                # buffer size for reading client request body
            #- NGINX_CLIENTMAXBODYSIZE=1m                   # maximum allowed size of the client request body
            #- NGINX_ACCESSLOG=0                            # enable access logs
            #- NGINX_INCLUDECONF=0                          # include files from conf.d/ directory
            #- NGINX_REUSEPORT=0                            # enable reuse port
            #- NGINX_SSL=0                                  # enable SSL support
            #- NGINX_SSLHTTP2=0                             # enable HTTP2 support
            #- NGINX_SSLCERTIFICATE=                        # SSL certificate file
            #- NGINX_SSLCERTIFICATEKEY=                     # SSL private key file
            #- NGINX_SSLDHPARAM=/etc/nginx/ssl/dhparam.pem  # SSL diffie-hellman parameters file
            #- NGINX_SSLPROTOCOLS=TLSv1 TLSv1.1 TLSv1.2     # SSL protocols
            #- NGINX_SSLCIPHERS=EECDH+AESGCM:EDH+AESGCM:AES256+EECDH:AES256+EDH # SSL ciphers
            #- NGINX_SSLREDIRECT=0                          # redirect HTTP to HTTPS
            #- NGINX_OPENFILECACHE=0                        # enable open file cache
            #- NGINX_GZIP=0                                 # enable gzip support
            #- NGINX_EXPIRE=0                               # enable expire on static content
            #- NGINX_EXPIREDELAY=1d                         # expire delay of static content
            #- NGINX_EXPIREACCESSLOG=0                      # enable access log for static content
            #- NGINX_STATUS=0                               # enable status page
            #- NGINX_STATUSLOCATION=/nginx_status           # status page location
            #- NGINX_STATUSALLOW=127.0.0.1                  # IP/CIDR allowed to access to status page (comma separated list)
            #- NGINX_PROXYSERVERS=myproxy:80                # proxy backend servers list
            #- NGINX_SERVERNAME=""                          # server names
            #- NGINX_ROOT=/var/www                          # root directory
            #- NGINX_INDEX=index.html                       # index pages
            #- NGINX_AUTHBASIC=                             # enable basic authentication
            #- NGINX_AUTHBASICUSERFILE=                     # basic authentication user file
            #- NGINX_PROXYBUFFERING=on                      # enable proxy buffering
            #- NGINX_PROXYCONNECTTIMEOUT=60s                # proxy connect timeout
            #- NGINX_PROXYREADTIMEOUT=60s                   # proxy read timeout
            #- NGINX_PROXYSENDTIMEOUT=60s                   # proxy send timeout
            #- NGINX_PROXYGZIP=0                            # enable gzip compression for proxy
            #- NGINX_PROXYACCESSLOG=0                       # enable proxy requests logs
            #- NGINX_PROXYCACHEVALID=                       # proxy cache valid codes/delay
            #- NGINX_PROXYCACHEUSESTALE=                    # proxy cache use stale
            #- NGINX_PROXYCACHEREVALIDATE=0                 # enable proxy cache revalidate
            #- NGINX_PROXYCACHEMINUSES=1                    # proxy cache min uses before caching
            #- NGINX_PROXYCACHEPATHLEVELS=1:2               # proxy cache path levels
            #- NGINX_PROXYCACHEPATHKEYSCACHESIZE=1m         # proxy cache path keys size
            #- NGINX_PROXYCACHEPATHMAXSIZE=1g               # proxy cache path max size
            #- NGINX_PROXYCACHEPATHINACTIVE=1d              # proxy cache path inactive period
            #- NGINX_UPSTREAMMETHOD=                        # load balancing method (set empty for default round-robin)
            #- NGINX_UPSTREAMKEEPALIVE=0                    # number of upstream minimal keepalive connections
            #- NGINX_UPSTREAMWEIGHT=1                       # weight of the server
            #- NGINX_UPSTREAMMAXCONNS=0                     # maximum connections to upstream server
            #- NGINX_UPSTREAMMAXFAILS=1                     # number of unsuccessful attempts before marking upstream server as unavailable
            #- NGINX_UPSTREAMFAILTIMEOUT=10s                # time before marking upstream server as unavailable and period of unavailability

            #
            # template upstream
            #

            #- NGINX_WORKERPROCESSES=1                      # number of worker processes
            #- NGINX_WORKERCONNECTIONS=1024                 # number of connections per worker process
            #- NGINX_WORKERRLIMITNOFILE=2048                # limit of maximum number of open files
            #- NGINX_KEEPALIVETIMEOUT=75s                   # keepalive timeout
            #- NGINX_KEEPALIVEREQUESTS=100                  # maximum requests per connection with keepalive
            #- NGINX_RESETTIMEDOUTCONNECTION=off            # enable resetting timed out connections
            #- NGINX_CLIENTHEADERTIMEOUT=60s                # client header request timeout
            #- NGINX_CLIENTBODYTIMEOUT=60s                  # client body timeout
            #- NGINX_SENDTIMEOUT=60s                        # send timeout
            #- NGINX_CLIENTHEADERBUFFERSIZE=1k              # buffer size for reading client request header
            #- NGINX_LARGECLIENTHEADERBUFFERS=4 8k          # maximum number and size of buffers used for reading large client request header
            #- NGINX_CLIENTBODYBUFFERSIZE=8k                # buffer size for reading client request body
            #- NGINX_CLIENTMAXBODYSIZE=1m                   # maximum allowed size of the client request body
            #- NGINX_ACCESSLOG=0                            # enable access logs
            #- NGINX_INCLUDECONF=0                          # include files from conf.d/ directory
            #- NGINX_REUSEPORT=0                            # enable reuse port
            #- NGINX_SSL=0                                  # enable SSL support
            #- NGINX_SSLHTTP2=0                             # enable HTTP2 support
            #- NGINX_SSLCERTIFICATE=                        # SSL certificate file
            #- NGINX_SSLCERTIFICATEKEY=                     # SSL private key file
            #- NGINX_SSLDHPARAM=/etc/nginx/ssl/dhparam.pem  # SSL diffie-hellman parameters file
            #- NGINX_SSLPROTOCOLS=TLSv1 TLSv1.1 TLSv1.2     # SSL protocols
            #- NGINX_SSLCIPHERS=EECDH+AESGCM:EDH+AESGCM:AES256+EECDH:AES256+EDH # SSL ciphers
            #- NGINX_SSLREDIRECT=0                          # redirect HTTP to HTTPS
            #- NGINX_OPENFILECACHE=0                        # enable open file cache
            #- NGINX_GZIP=0                                 # enable gzip support
            #- NGINX_EXPIRE=0                               # enable expire on static content
            #- NGINX_EXPIREDELAY=1d                         # expire delay of static content
            #- NGINX_EXPIREACCESSLOG=0                      # enable access log for static content
            #- NGINX_STATUS=0                               # enable status page
            #- NGINX_STATUSLOCATION=/nginx_status           # status page location
            #- NGINX_STATUSALLOW=127.0.0.1                  # IP/CIDR allowed to access to status page (comma separated list)
            #- NGINX_UPSTREAMSERVERS=nginx:80               # backend servers list
            #- NGINX_SERVERNAME=""                          # server names
            #- NGINX_ROOT=/var/www                          # root directory
            #- NGINX_INDEX=index.html                       # index pages
            #- NGINX_PROXYBUFFERING=on                      # enable proxy buffering
            #- NGINX_PROXYCONNECTTIMEOUT=60s                # proxy connect timeout
            #- NGINX_PROXYREADTIMEOUT=60s                   # proxy read timeout
            #- NGINX_PROXYSENDTIMEOUT=60s                   # proxy send timeout
            #- NGINX_PROXYGZIP=0                            # enable gzip compression for proxy
            #- NGINX_PROXYACCESSLOG=0                       # enable proxy requests logs
            #- NGINX_UPSTREAMMETHOD=                        # load balancing method (set empty for default round-robin)
            #- NGINX_UPSTREAMKEEPALIVE=0                    # number of upstream minimal keepalive connections
            #- NGINX_UPSTREAMWEIGHT=1                       # weight of the server
            #- NGINX_UPSTREAMMAXCONNS=0                     # maximum connections to upstream server
            #- NGINX_UPSTREAMMAXFAILS=1                     # number of unsuccessful attempts before marking upstream server as unavailable
            #- NGINX_UPSTREAMFAILTIMEOUT=10s                # time before marking upstream server as unavailable and period of unavailability

Tag summary

Content type

Image

Digest

Size

17.8 MB

Last updated

almost 7 years ago

docker pull zerolabssyseng/nginx