mirror of
https://github.com/booklore-app/booklore.git
synced 2025-12-23 22:28:11 -05:00
WIP: Docker
This commit is contained in:
42
nginx.conf
42
nginx.conf
@@ -1,27 +1,43 @@
|
||||
# the events block is required
|
||||
events{}
|
||||
events {}
|
||||
|
||||
http {
|
||||
# include the default mime.types to map file extensions to MIME types
|
||||
include /etc/nginx/mime.types;
|
||||
|
||||
server {
|
||||
# set the root directory for the server (we need to copy our
|
||||
# application files here)
|
||||
listen 6060; # Listen on port 6060 for both API and UI
|
||||
|
||||
# Set the root directory for the server (Angular app)
|
||||
root /usr/share/nginx/html;
|
||||
|
||||
# set the default index file for the server (Angular generates the
|
||||
# index.html file for us and it will be in the above directory)
|
||||
# Set the default index file for the server
|
||||
index index.html;
|
||||
|
||||
# specify the configuration for the '/' location
|
||||
# Serve Angular UI
|
||||
location / {
|
||||
# try to serve the requested URI. if that fails then try to
|
||||
# serve the URI with a trailing slash. if that fails, then
|
||||
# serve the index.html file; this is needed in order to serve
|
||||
# Angular routes--e.g.,'localhost:8080/customer' will serve
|
||||
# the index.html file
|
||||
try_files $uri $uri/ /index.html;
|
||||
try_files $uri $uri/ /index.html; # Fallback to index.html for Angular routing
|
||||
}
|
||||
|
||||
# Proxy API requests that start with /v1/ to the backend
|
||||
location /v1/ {
|
||||
proxy_pass http://localhost:8080; # Backend API running on port 8080
|
||||
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 WebSocket requests (ws://) to the backend
|
||||
location /ws {
|
||||
proxy_pass http://localhost:8080/ws; # Backend WebSocket endpoint
|
||||
proxy_http_version 1.1; # Ensure HTTP 1.1 is used for WebSocket connection
|
||||
proxy_set_header Upgrade $http_upgrade; # Pass the upgrade header
|
||||
proxy_set_header Connection 'upgrade'; # Pass the connection header
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user