├── .gitignore ├── conf.d ├── default.conf └── default-ssl.conf ├── README.md └── Dockerfile /.gitignore: -------------------------------------------------------------------------------- 1 | 2 | .DS_Store 3 | -------------------------------------------------------------------------------- /conf.d/default.conf: -------------------------------------------------------------------------------- 1 | server { 2 | 3 | listen 80; 4 | #allow acces to Dashboard from this host 5 | include /opt/verynginx/verynginx/nginx_conf/in_server_block.conf; 6 | server_name localhost; 7 | 8 | root html; 9 | index index index.html index.htm index.php; 10 | 11 | # Add stdout logging for development 12 | 13 | error_log /dev/stdout debug; 14 | access_log /dev/stdout; 15 | 16 | location / { 17 | try_files $uri $uri/ /index.php?$query_string; 18 | } 19 | 20 | location ~ \.php$ { 21 | try_files $uri =404; 22 | fastcgi_split_path_info ^(.+\.php)(/.+)$; 23 | fastcgi_pass unix:/sock/php5-fpm.sock; 24 | fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; 25 | fastcgi_param SCRIPT_NAME $fastcgi_script_name; 26 | fastcgi_index index.php; 27 | include fastcgi_params; 28 | } 29 | 30 | location ~ /\. { 31 | log_not_found off; 32 | deny all; 33 | } 34 | 35 | } 36 | -------------------------------------------------------------------------------- /conf.d/default-ssl.conf: -------------------------------------------------------------------------------- 1 | server { 2 | listen 80; 3 | server_name domain.tld; 4 | return 301 https://www.domain.tld$request_uri; 5 | } 6 | 7 | server { 8 | 9 | listen 443 default ssl http2; 10 | #allow acces to Dashboard from this host 11 | include /opt/verynginx/verynginx/nginx_conf/in_server_block.conf; 12 | server_name www.domain.tld; 13 | access_log /var/log/nginx/default-ssl.access.log; 14 | error_log /var/log/nginx/default-ssl.error.log; 15 | 16 | ssl_certificate /etc/nginx/ssl/your-cert.crt; 17 | ssl_certificate_key /etc/nginx/ssl/your-key.key; 18 | 19 | ssl_dhparam /etc/nginx/ssl/dhparam.pem; 20 | 21 | root html; 22 | index index.php; 23 | 24 | sendfile on; 25 | 26 | location / { 27 | try_files $uri $uri/ /index.php?$query_string; 28 | client_body_buffer_size 256k; 29 | } 30 | 31 | 32 | location ~ \.php$ { 33 | try_files $uri =404; 34 | fastcgi_split_path_info ^(.+\.php)(/.+)$; 35 | fastcgi_pass unix:/sock/php5-fpm.sock; 36 | fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; 37 | fastcgi_param SCRIPT_NAME $fastcgi_script_name; 38 | fastcgi_index index.php; 39 | include fastcgi_params; 40 | } 41 | 42 | 43 | location ~ /\. { 44 | log_not_found off; 45 | deny all; 46 | } 47 | 48 | } 49 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | 2 | # [WIP] 3 | 4 | # VeryNginx Dockerfile 5 | 6 | 7 | A very powerful and friendly nginx based on lua-nginx-module [OpenResty](https://openresty.org) which provide WAF, Control Panel and Dashboards. 8 | 9 | 10 | ImageLayers : [![](https://badge.imagelayers.io/camil/verynginx:latest.svg)](https://imagelayers.io/?images=camil/verynginx:latest) 11 | 12 | 13 | This repository contains **Dockerfile** of [VeryNginx](https://github.com/alexazhou/VeryNginx) 14 | 15 | 16 | 17 | ## Informations 18 | 19 | 20 | * Based on [Alpine Linux](http://www.alpinelinux.org/) [alpine:3.4](https://hub.docker.com/r/_/alpine/) 21 | 22 | ## Installation 23 | 24 | 25 | docker pull camil/verynginx 26 | cd ~ 27 | git clone https://github.com/camilb/docker-verynginx.git 28 | 29 | 30 | ## Build 31 | 32 | 33 | For example, if you need to install [Extra Modules](https://openresty.org), edit the Dockerfile and than build-it. 34 | 35 | cd ~/docker-verynginx 36 | docker build --rm -t camil/verynginx . 37 | 38 | # Usage 39 | 40 | 41 | `Remove or modify conf.d/domain.conf and conf.d/domain-ssl.conf to match your needs :` 42 | 43 | 44 | cd ~/docker-verynginx 45 | docker run -d -v $PWD/conf.d:/etc/nginx/conf.d -p 80:80 -p 443:443 camil/verynginx 46 | 47 | 48 | ###Test it: 49 | 50 | http://localhost/verynginx/index.html 51 | 52 | user: verynginx 53 | pass: verynginx 54 | -------------------------------------------------------------------------------- /Dockerfile: -------------------------------------------------------------------------------- 1 | FROM alpine:3.4 2 | 3 | ENV OPENRESTY_VERSION 1.11.2.1 4 | ENV OPENRESTY_PREFIX /opt/verynginx/openresty 5 | ENV NGINX_PREFIX /opt/verynginx/openresty/nginx 6 | ENV VAR_PREFIX /var/nginx 7 | 8 | RUN apk update \ 9 | && apk add --virtual build-deps \ 10 | make gcc musl-dev \ 11 | pcre-dev openssl-dev zlib-dev ncurses-dev readline-dev \ 12 | curl perl \ 13 | && mkdir -p /root/ngx_openresty \ 14 | && cd /root/ngx_openresty \ 15 | && curl -sSL http://openresty.org/download/openresty-${OPENRESTY_VERSION}.tar.gz | tar -xvz \ 16 | && cd openresty-* \ 17 | && readonly NPROC=$(grep -c ^processor /proc/cpuinfo 2>/dev/null || 1) \ 18 | && ./configure \ 19 | --prefix=$OPENRESTY_PREFIX \ 20 | --http-client-body-temp-path=$VAR_PREFIX/client_body_temp \ 21 | --http-proxy-temp-path=$VAR_PREFIX/proxy_temp \ 22 | --http-log-path=$VAR_PREFIX/access.log \ 23 | --error-log-path=$VAR_PREFIX/error.log \ 24 | --pid-path=$VAR_PREFIX/nginx.pid \ 25 | --lock-path=$VAR_PREFIX/nginx.lock \ 26 | --user=www-data \ 27 | --group=www-data \ 28 | --with-luajit \ 29 | --with-pcre-jit \ 30 | --with-http_ssl_module \ 31 | --with-http_v2_module \ 32 | --without-http_ssi_module \ 33 | --without-http_userid_module \ 34 | --without-http_uwsgi_module \ 35 | --with-http_stub_status_module \ 36 | -j${NPROC} \ 37 | && make -j${NPROC} \ 38 | && make install \ 39 | && ln -sf $NGINX_PREFIX/sbin/nginx /usr/local/bin/nginx \ 40 | && ln -sf $NGINX_PREFIX/sbin/nginx /usr/local/bin/openresty \ 41 | && ln -sf $OPENRESTY_PREFIX/bin/resty /usr/local/bin/resty \ 42 | && ln -sf $OPENRESTY_PREFIX/luajit/bin/luajit-* $OPENRESTY_PREFIX/luajit/bin/lua \ 43 | && ln -sf $OPENRESTY_PREFIX/luajit/bin/luajit-* /usr/local/bin/lua \ 44 | && apk del build-deps \ 45 | && apk add \ 46 | libpcrecpp libpcre16 libpcre32 openssl libssl1.0 pcre libgcc libstdc++ git \ 47 | && rm -rf /var/cache/apk/* \ 48 | && rm -rf /root/ngx_openresty 49 | 50 | RUN addgroup -g 1000 www-data && adduser -D -G www-data -s /bin/false -u 1000 www-data 51 | 52 | RUN git clone https://github.com/camilb/VeryNginx.git \ 53 | && rm -f $NGINX_PREFIX/conf/nginx.conf \ 54 | && cp ./VeryNginx/nginx.conf $NGINX_PREFIX/conf/nginx.conf \ 55 | && cp -r ./VeryNginx/verynginx /opt/verynginx \ 56 | && chown -R www-data:www-data /opt/verynginx \ 57 | && rm -rf ./verynginx 58 | WORKDIR $NGINX_PREFIX/ 59 | 60 | CMD ["/opt/verynginx/openresty/nginx/sbin/nginx", "-g", "daemon off; error_log /dev/stderr info;"] 61 | --------------------------------------------------------------------------------