Skip to content

Commit

Permalink
chore: refactor nginx config
Browse files Browse the repository at this point in the history
  • Loading branch information
soulteary committed Mar 17, 2024
1 parent 0563319 commit 4c34e6a
Show file tree
Hide file tree
Showing 5 changed files with 67 additions and 72 deletions.
4 changes: 1 addition & 3 deletions docker/docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -307,9 +307,7 @@ services:
image: nginx:latest
restart: always
volumes:
- ./nginx/nginx.conf:/etc/nginx/nginx.conf
- ./nginx/proxy.conf:/etc/nginx/proxy.conf
- ./nginx/conf.d:/etc/nginx/conf.d
- ./nginx.conf:/etc/nginx/nginx.conf
depends_on:
- api
- web
Expand Down
66 changes: 66 additions & 0 deletions docker/nginx.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
user nginx;
worker_processes auto;

error_log /var/log/nginx/error.log notice;
pid /var/run/nginx.pid;

events {
worker_connections 1024;
}

http {
include /etc/nginx/mime.types;
default_type application/octet-stream;

log_format main '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';

access_log /var/log/nginx/access.log main;

sendfile on;
keepalive_timeout 65;
client_max_body_size 15M;

server {
listen 80;
server_name _;

proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_http_version 1.1;
proxy_set_header Connection "";
proxy_buffering off;
proxy_read_timeout 3600s;
proxy_send_timeout 3600s;

location @backend {
proxy_pass http://api:5001;
}

location @frontend {
proxy_pass http://web:3000;
}

location /console/api {
try_files $uri $uri/ @backend;
}

location /api {
try_files $uri $uri/ @backend;
}

location /v1 {
try_files $uri $uri/ @backend;
}

location /files {
try_files $uri $uri/ @backend;
}

location / {
try_files $uri $uri/ @frontend;
}
}
}
29 changes: 0 additions & 29 deletions docker/nginx/conf.d/default.conf

This file was deleted.

32 changes: 0 additions & 32 deletions docker/nginx/nginx.conf

This file was deleted.

8 changes: 0 additions & 8 deletions docker/nginx/proxy.conf

This file was deleted.

0 comments on commit 4c34e6a

Please sign in to comment.