Skip to content

funnyzak/nginx-docker

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

24 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Nginx Docker

Build Status Docker Stars Docker Pulls GitHub release (latest by date) GitHub

A nginx docker image with some useful modules.

Download size of this image is:

Image Size

Docker hub image: funnyzak/nginx

Docker Pull Command: docker pull funnyzak/nginx:latest

Installed Modules

More modules can be found in Dockerfile.

Usage

docker

First, create a nginx.conf file in your project directory, and then run the following command:

docker run -d -t -i --name nginx --restar on-failure \
  -v /path/to/nginx.conf:/etc/nginx/nginx.conf \
  -v /path/to/conf.d:/etc/nginx/conf.d \
  -p 1688:80 \
  funnyzak/nginx

docker-compose

First, create a docker-compose.yml file in your project directory:

version: “3.3”
services:
  nginx:
    image: funnyzak/nginx
    container_name: nginx
    environment:
      - TZ=Asia/Shanghai
    volumes:
      - ./nginx/nginx.conf:/etc/nginx/nginx.conf
      - ./nginx/conf.d:/etc/nginx/conf.d
    restart: on-failure
    ports:
      - “1688:80” 

Now, running docker-compose up -d will run the application for you.

Docker Build

docker build \
--build-arg VCS_REF=`git rev-parse --short HEAD` \
--build-arg BUILD_DATE=`date -u +"%Y-%m-%dT%H:%M:%SZ"` \
--build-arg VERSION="1.23.3"
-t funnyzak/nginx:1.23.3 .

Conf Configuration

Nginx.conf

load_module /usr/lib64/nginx/modules/ngx_http_image_filter_module.so;
load_module /usr/lib64/nginx/modules/ngx_stream_module.so;
load_module /usr/lib64/nginx/modules/ngx_http_geoip_module.so;
load_module /usr/lib64/nginx/modules/ngx_http_xslt_filter_module.so;
load_module /usr/lib64/nginx/modules/ngx_stream_geoip_module.so;
# load_module /usr/lib64/nginx/modules/ngx_http_perl_module.so;
# load_module /usr/lib64/nginx/modules/ngx_mail_module.so;

user  nginx;
worker_processes  1;

#error_log  logs/error.log;
#error_log  logs/error.log  notice;
#error_log  logs/error.log  info;

#pid        logs/nginx.pid;


events {
    worker_connections  1024;
}


http {
    include       mime.types;
    default_type  application/octet-stream;

    #log_format  main  ‘$remote_addr - $remote_user [$time_local] “$request” ‘
    #                  ‘$status $body_bytes_sent “$http_referer” ‘
    #                  ‘”$http_user_agent” “$http_x_forwarded_for”’;

    #access_log  logs/access.log  main;

    sendfile        on;
    #tcp_nopush     on;

    #keepalive_timeout  0;
    keepalive_timeout  65;

    #gzip  on;

    include /etc/nginx/conf.d/*.conf;
}

Reference

Contribution

If you have any questions or suggestions, please feel free to submit an issue or pull request.

License

MIT License © 2022 funnyzak