Add Docker Compose support

This commit is contained in:
Wietse Wind
2023-10-07 03:25:18 +02:00
parent 236958a8e0
commit 3c9d87d6e9
3 changed files with 150 additions and 0 deletions

96
conf/nginx.conf Normal file
View File

@@ -0,0 +1,96 @@
user nginx;
worker_processes auto;
error_log /dev/stderr 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 /dev/stdout main;
sendfile on;
#tcp_nopush on;
keepalive_timeout 65;
# gzip on;
map $http_connection $connection_upgrade {
"~*Upgrade" $http_connection;
default keep-alive;
}
map $http_content_type $is_json_request {
"application/json" 1;
default 0;
}
upstream backend {
server xpop:3000;
keepalive 32;
}
server {
listen 3000;
server_name _;
autoindex_format html;
location /xpop {
root /usr/share/nginx/html;
autoindex off;
}
if ($http_content_type ~* json) {
set $json_request 1;
}
location ~ ^/json(/.*)?$ {
internal;
alias /usr/share/nginx/html$1; # Point to the same root as the previous location
autoindex on;
autoindex_format json;
}
location ~* ^/[0-9]+ {
root /usr/share/nginx/html;
autoindex on;
if ($is_json_request = 1) {
rewrite ^ /json$request_uri? last;
}
}
location / {
proxy_pass http://backend;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $connection_upgrade;
proxy_cache off;
proxy_buffering off;
# Configuration for LongPolling or if your KeepAliveInterval is longer than 60 seconds
proxy_read_timeout 100s;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
# proxy_set_header X-Forwarded-Proto $scheme;
}
# error_page 404 /404.html;
# redirect server error pages to the static page /50x.html
#
# error_page 500 502 503 504 /50x.html;
# location = /50x.html {
# root /usr/share/nginx/html;
# }
} # END: server {}
}