From 7c3d3d391d2bacf3ff3d26465a95c2cadd518e14 Mon Sep 17 00:00:00 2001 From: Kai Salmen Date: Fri, 6 Oct 2017 23:24:52 +0200 Subject: [PATCH] Add docker-compose for nginx as dev http-server. Update README.md with usage instructions. --- .gitignore | 6 +----- README.md | 14 ++++++++++++++ docker-compose.yml | 11 +++++++++++ resource/nginx/nginx.conf | 34 ++++++++++++++++++++++++++++++++++ 4 files changed, 60 insertions(+), 5 deletions(-) create mode 100644 docker-compose.yml create mode 100644 resource/nginx/nginx.conf diff --git a/.gitignore b/.gitignore index dc6c93a2..24a30228 100644 --- a/.gitignore +++ b/.gitignore @@ -6,11 +6,7 @@ /node /node_modules -/resource/obj/14 -/resource/obj/1701 -/resource/obj/11707 -/resource/obj/11811 -/resource/obj/12120 +/resource/obj/1* /resource/obj/capsule /resource/obj/Cerberus /resource/obj/datamogensen diff --git a/README.md b/README.md index 5d338fc6..a32d21ae 100644 --- a/README.md +++ b/README.md @@ -71,6 +71,20 @@ Version 2.0.0 introduced substantial enhancements and chances especially but not [LoaderDirector - Mesh Spray](https://kaisalmen.de/proto/test/meshspray/main.src.html)
[LoaderDirector Parallels Demo](https://kaisalmen.de/proto/test/wwparallels/main.src.html)
+## Http server for development +If you have `docker` and `docker-compose` installed on your development platform, you are now able to launch `nginx` which is serving the complete content of this repository. Any changes to files are directly available in the HTTP server. This is solely meant for development. + +From the command-line, use the following command to launch the HTTP server: +```bash +docker-compose up -d +``` +Content is available here: [http://localhost:8085](http://localhost:8085)
+Nginx configuration is stored here: `resource/nginx/nginx.conf`. Adjust according your needs. + +From the command-line, use the following to stop the HTTP server: +```bash +docker-compose down +``` Have fun! diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 00000000..8d7eb471 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,11 @@ +version: '3.3' + +services: + obj2nginx: + image: nginx + ports: + - 8085:80 + volumes: + - .:/usr/share/nginx/html:ro + - ./resource/nginx/nginx.conf:/etc/nginx/nginx.conf:ro + container_name: obj2nginx diff --git a/resource/nginx/nginx.conf b/resource/nginx/nginx.conf new file mode 100644 index 00000000..3815e0c0 --- /dev/null +++ b/resource/nginx/nginx.conf @@ -0,0 +1,34 @@ + +worker_processes 1; + +events { + worker_connections 1024; +} + +http { + include mime.types; + default_type application/octet-stream; + + sendfile on; + keepalive_timeout 65; + + server { + listen 80; + server_name localhost; + + location / { + root /usr/share/nginx/html; + index index.html index.htm; + autoindex on; + } + + # redirect server error pages to the static page /50x.html + # + error_page 500 502 503 504 /50x.html; + location = /50x.html { + root /usr/share/nginx/html; + } + + } + +}