add nginx.conf

This commit is contained in:
tuanvu
2026-02-11 13:59:28 +01:00
parent fa0575edc0
commit f98318f7da
3 changed files with 31 additions and 3 deletions

View File

@@ -1,10 +1,10 @@
services:
nginx:
image: nginx:latest
build:
context: ..
dockerfile: dockerfiles/nginx/Dockerfile
ports:
- "80:80"
volumes:
- ./nginx.conf:/etc/nginx/nginx.conf:ro
depends_on:
- db
- etherpad

View File

@@ -0,0 +1,2 @@
FROM nginx:latest
COPY dockerfiles/nginx/nginx.conf /etc/nginx/conf.d/default.conf

View File

@@ -0,0 +1,26 @@
server {
listen 80;
server_name _;
root /usr/share/nginx/html;
index index.html;
##########################
# Proxy API requests to the back service
##########################
location /api/ {
proxy_pass http://back:8080/api/;
proxy_http_version 1.1;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header Connection "";
}
##########################
# FrontEnd returns
##########################
location / {
try_files $uri $uri/ /index.html;
}
}