Skip to content

Instantly share code, notes, and snippets.

@kekru
Last active July 1, 2021 18:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kekru/dad3e8b21b9b18fa556cd6cb23ca733a to your computer and use it in GitHub Desktop.
Save kekru/dad3e8b21b9b18fa556cd6cb23ca733a to your computer and use it in GitHub Desktop.
docker nginx static file and proxy pass

nginx docker serve static files

Simple Docker Setup for serving static files and proxy pass a path to a server

Just click "Download ZIP" oder "Embed -> Clone" and then run docker-compose up.
The server is available on http://localhost:8080 and will serve the files in ./static

version: "3.3"
services:
nginx:
build: .
ports:
- 8080:80
volumes:
- ./static:/html:ro
FROM nginx:1.16.1-alpine
COPY nginx.conf /etc/nginx/conf.d/custom.conf
server {
listen 80;
server_name localhost;
root /html;
location /api {
proxy_pass https://example.com/api;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment