131 lines
4.4 KiB
Cheetah
131 lines
4.4 KiB
Cheetah
server {
|
|
listen 80;
|
|
server_name localhost;
|
|
client_max_body_size 5m;
|
|
# Uncomment the following block (Line6 to Line24) to enable redirect HTTP to HTTPS
|
|
# Redirect HTTP to HTTPS
|
|
# Using 8443 port because that is what is exposed in docker-compose
|
|
# location / {
|
|
# return 301 https://$host:8443$request_uri;
|
|
# }
|
|
# }
|
|
|
|
# server {
|
|
# listen 443 ssl;
|
|
# server_name localhost;
|
|
|
|
# ssl_certificate /etc/nginx/ssl/server.crt;
|
|
# ssl_certificate_key /etc/nginx/ssl/server.key;
|
|
|
|
# ssl_session_cache shared:SSL:1m;
|
|
# ssl_session_timeout 5m;
|
|
|
|
# ssl_ciphers HIGH:!aNULL:!MD5;
|
|
# ssl_prefer_server_ciphers on;
|
|
|
|
# gRPC endpoint
|
|
location /grpc/ {
|
|
if ($request_method = OPTIONS) {
|
|
add_header 'Access-Control-Allow-Origin' "$http_origin" always;
|
|
add_header 'Access-Control-Allow-Credentials' 'true' always;
|
|
add_header 'Access-Control-Allow-Methods' 'POST,GET,OPTIONS' always;
|
|
add_header 'Access-Control-Allow-Headers' 'Accept,Accept-Language,Content-Type,Content-Length,X-Grpc-Web,X-User-Agent,Grpc-Timeout,Authorization,Connect-Protocol-Version' always;
|
|
return 204;
|
|
}
|
|
proxy_pass http://${BACKEND_HOST}:${BACKEND_GRPC_WEB_PORT}/;
|
|
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 X-Grpc-Web $http_x_grpc_web;
|
|
proxy_set_header X-User-Agent $http_x_user_agent;
|
|
}
|
|
|
|
# MinIO Console
|
|
location = /minio {
|
|
return 301 /minio/;
|
|
}
|
|
|
|
location /minio/ {
|
|
rewrite ^/minio/(.*)$ /$1 break;
|
|
proxy_pass http://${MINIO_HOST}:${MINIO_CONSOLE_PORT};
|
|
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 X-Forwarded-Prefix /minio;
|
|
proxy_redirect off;
|
|
|
|
proxy_http_version 1.1;
|
|
proxy_set_header Upgrade $http_upgrade;
|
|
proxy_set_header Connection $connection_upgrade;
|
|
}
|
|
|
|
# Public storage path
|
|
location = /storage {
|
|
return 301 /storage/;
|
|
}
|
|
|
|
location /storage/ {
|
|
rewrite ^/storage/(.*)$ /${MINIO_BUCKET}/$1 break;
|
|
proxy_pass http://${MINIO_HOST}:${MINIO_API_PORT};
|
|
proxy_set_header Host ${MINIO_HOST}:${MINIO_API_PORT};
|
|
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;
|
|
}
|
|
|
|
# Frontend (dev/prod on same port)
|
|
location / {
|
|
proxy_pass http://${FRONTEND_HOST}:80;
|
|
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;
|
|
|
|
# Vite HMR WebSocket support
|
|
proxy_http_version 1.1;
|
|
proxy_set_header Upgrade $http_upgrade;
|
|
proxy_set_header Connection $connection_upgrade;
|
|
}
|
|
|
|
# New collab WebSocket path
|
|
location = /ws/doc {
|
|
return 301 /ws/doc/;
|
|
}
|
|
|
|
location /ws/doc/ {
|
|
proxy_pass http://${COLLAB_HOST}:${COLLAB_GATEWAY_PORT};
|
|
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_http_version 1.1;
|
|
proxy_set_header Upgrade $http_upgrade;
|
|
proxy_set_header Connection $connection_upgrade;
|
|
}
|
|
|
|
# RabbitMQ Management Interface
|
|
location /rabbitmq/ {
|
|
proxy_pass http://${RABBITMQ_HOST}:${RABBITMQ_MANAGEMENT_PORT}/;
|
|
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_redirect off;
|
|
|
|
# Handle WebSocket connections for management UI
|
|
proxy_http_version 1.1;
|
|
proxy_set_header Upgrade $http_upgrade;
|
|
proxy_set_header Connection "upgrade";
|
|
}
|
|
|
|
|
|
error_page 404 /404.html;
|
|
error_page 500 502 503 504 /50x.html;
|
|
location = /50x.html {
|
|
root /usr/share/nginx/html;
|
|
}
|
|
}
|