Coder Social home page Coder Social logo

nginx's Introduction

Nginx

Build Status

This repository contains Dockerfile of Nginx for Docker.

It's a simple and lightweight nginx image, based on the official nginx image.

It just add a more complete default config file to start the server.

Usage

You can run a new instance of nginx using:

docker run -d --name nginx -p 80:80 mike325/nginx:latest

or using docker-compose, just create a docker-compose.yml

version: '2'

services:
    nginx:
        image: mike325/nginx:latest
        restart: always
        container_name: nginx
        ports:
            - "80:80"
        volumes:
            - /etc/nginx/sites-enabled:/etc/nginx/sites-enabled
            - /etc/nginx/logs:/var/log/nginx
        networks:
            - reverse_proxy

networks:
    reverse_proxy:
        driver: bridge

and run docker-compose up -d nginx

Attach persistent/shared directories

You may also want to use your own virtual host or use certificates to encrypt your sites:

docker run -d \
    --name nginx \
    -p 80:80 \
    -p 443:443 \
    -v <sites-enabled-dir>:/etc/nginx/sites-enabled \
    -v <certs-dir>:/etc/nginx/certs \
    -v <logs-dir>:/var/log/nginx \
    mike325/nginx:latest

You can check the example.conf to configure the image to reverse proxy your sites.

Manual build

You can also build an image from the Dockerfile to modify the nginx.conf file:

git clone https://github.com/mike325/nginx
cd nginx
docker build -t custom_nginx .
docker run --name custom_nginx -p 80:80 custom_nginx

or with docker-compose using your docker-compose.yml:

version: '2'

services:
    custom_nginx:
        build: .
        restart: always
        container_name: custom_nginx
        ports:
            - "80:80"
        volumes:
            - /etc/nginx/sites-enabled:/etc/nginx/sites-enabled
            - /etc/nginx/logs:/var/log/nginx
        networks:
            - reverse_proxy

networks:
    reverse_proxy:
        driver: bridge

and run docker-compose up -d custom_nginx

nginx's People

Contributors

mike325 avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.