109 lines
3.4 KiB
Nginx Configuration File
109 lines
3.4 KiB
Nginx Configuration File
events {
|
|
worker_connections 1024;
|
|
}
|
|
|
|
http {
|
|
include /etc/nginx/mime.types;
|
|
default_type application/octet-stream;
|
|
|
|
# Logging
|
|
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;
|
|
error_log /var/log/nginx/error.log;
|
|
|
|
# Gzip compression
|
|
gzip on;
|
|
gzip_vary on;
|
|
gzip_min_length 1024;
|
|
gzip_types text/plain text/css application/json application/javascript text/xml application/xml;
|
|
|
|
# Resolver for Docker DNS
|
|
resolver 127.0.0.11 valid=30s;
|
|
|
|
# Main server - serves static files and proxies to services
|
|
server {
|
|
listen 80;
|
|
server_name _;
|
|
|
|
# For Let's Encrypt challenges
|
|
location /.well-known/acme-challenge/ {
|
|
root /var/www/certbot;
|
|
}
|
|
|
|
# Health check endpoint
|
|
location /health {
|
|
access_log off;
|
|
return 200 "healthy\n";
|
|
add_header Content-Type text/plain;
|
|
}
|
|
|
|
# API proxy
|
|
location /api/ {
|
|
set $api_backend xflow-api:8080;
|
|
proxy_pass http://$api_backend;
|
|
proxy_http_version 1.1;
|
|
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_connect_timeout 60s;
|
|
proxy_send_timeout 60s;
|
|
proxy_read_timeout 60s;
|
|
}
|
|
|
|
# Gitea proxy
|
|
location /git/ {
|
|
set $gitea_backend gitea:3000;
|
|
proxy_pass http://$gitea_backend/;
|
|
proxy_http_version 1.1;
|
|
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-Host $host;
|
|
proxy_set_header X-Forwarded-Prefix /git;
|
|
}
|
|
|
|
# Default - static files
|
|
location / {
|
|
root /usr/share/nginx/html;
|
|
try_files $uri $uri/ /index.html;
|
|
}
|
|
}
|
|
|
|
# HTTPS server (uncomment when SSL certificates are ready)
|
|
# server {
|
|
# listen 443 ssl http2;
|
|
# server_name your-domain.com;
|
|
#
|
|
# ssl_certificate /etc/letsencrypt/live/your-domain.com/fullchain.pem;
|
|
# ssl_certificate_key /etc/letsencrypt/live/your-domain.com/privkey.pem;
|
|
#
|
|
# location / {
|
|
# root /usr/share/nginx/html;
|
|
# try_files $uri $uri/ /index.html;
|
|
# }
|
|
#
|
|
# location /api/ {
|
|
# proxy_pass http://xflow_api/;
|
|
# proxy_http_version 1.1;
|
|
# 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;
|
|
# }
|
|
#
|
|
# location /git/ {
|
|
# proxy_pass http://gitea/;
|
|
# proxy_http_version 1.1;
|
|
# 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;
|
|
# }
|
|
# }
|
|
}
|