Skip to content

madrigals1/nginx_static

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

25 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Nginx Static Hosting

Project for hosting static files using Nginx + Docker.

Prerequisites

Make sure you have installed these:

  • Docker and Docker Compose - Will install all the required packages and software.
  • (Optional) Dockerized Nginx - Will generate SSL certificates and make the app accessible through HTTPS_NETWORK, that is set inside .env.

Installation

Make a copy of .env.example file named .env

cp .env.example .env

Environment variables:

  • PORT - port on which the app will be running.
  • DOCKER_STATIC_HOSTING - place, where we will save all of our files.
  • SSL settings (Not needed without Dockerized Nginx):
    • HTTPS_NETWORK - network, in which our Dockerized Nginx is running.
PORT=8800
DOCKER_STATIC_HOSTING=/var/www/static
HTTPS_NETWORK=https_network

Create network with the name, that we have in HTTPS_NETWORK environment variable.

docker network create https_network

Build the Docker image

docker-compose build

Running

Start

docker-compose up

Stop

docker-compose down

Usage

  • Put any file inside ${DOCKER_STATIC_HOSTING}/<path_to_the_file> folder.
  • File will be accessible under <url>/<path_to_the_file>

<url> will be localhost:${PORT} if running without Dockerized Nginx or you can create SSL Certificate and Proxy Host using Dockerized Nginx

Authors

About

Nginx for hosting static files

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages