Skip to content

Commit

Permalink
Restructure nginx configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
daniel-battaglia committed Oct 19, 2023
1 parent 8de0220 commit b8cce34
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 32 deletions.
3 changes: 2 additions & 1 deletion angular-frontend/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ FROM nginxinc/nginx-unprivileged:stable

COPY dist/angular-frontend /usr/share/nginx/html
RUN mkdir /etc/nginx/templates
COPY nginx.conf /etc/nginx/templates/default.conf.template
COPY backend.nginx.conf.template /etc/nginx/templates/backend.conf.template
COPY nginx.conf /etc/nginx/conf.d/websocket.conf

EXPOSE 80
33 changes: 2 additions & 31 deletions angular-frontend/nginx.conf
Original file line number Diff line number Diff line change
@@ -1,36 +1,7 @@
server {
listen 80;
sendfile on;
default_type application/octet-stream;
tcp_nopush on;
tcp_nodelay on;

http {
# Connection header for WebSocket reverse proxy
map $http_upgrade $connection_upgrade {
default upgrade;
'' close;
}

gzip on;
gzip_http_version 1.1;
gzip_disable "MSIE [1-6]\.";
gzip_min_length 256;
gzip_vary on;
gzip_proxied expired no-cache no-store private auth;
gzip_types text/plain text/css application/json application/javascript application/x-javascript text/xml application/xml application/xml+rss text/javascript;
gzip_comp_level 9;

root /usr/share/nginx/html;

location / {
try_files $uri $uri/ /index.html =404;
}

location ~ \/(connect|app|topic)\/ {
proxy_pass ${SPRING_BACKEND}$1;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $connection_upgrade;
proxy_set_header Host $host;
"" close;
}
}

0 comments on commit b8cce34

Please sign in to comment.