f1e0f6b5ef
- Add complete server infrastructure with Gitea, API, PostgreSQL - Implement Obsidian-compatible markdown mindmap converter - Add Flutter service for server synchronization - Configure GitHub Actions for automated build and deploy - Add production docker-compose with health checks - Include VPS setup and deployment scripts - Add comprehensive deployment documentation
125 lines
3.6 KiB
Nginx Configuration File
125 lines
3.6 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;
|
|
|
|
# Upstream servers
|
|
upstream gitea {
|
|
server gitea:3000;
|
|
}
|
|
|
|
upstream nanaxe_api {
|
|
server nanaxe-api:8080;
|
|
}
|
|
|
|
# HTTP server - redirects to HTTPS
|
|
server {
|
|
listen 80;
|
|
server_name _;
|
|
|
|
# For Let's Encrypt challenges
|
|
location /.well-known/acme-challenge/ {
|
|
root /var/www/certbot;
|
|
}
|
|
|
|
# Uncomment for HTTPS redirect
|
|
# return 301 https://$server_name$request_uri;
|
|
|
|
# Or proxy to services for local development
|
|
location / {
|
|
root /usr/share/nginx/html;
|
|
try_files $uri $uri/ /index.html;
|
|
}
|
|
}
|
|
|
|
# API Server
|
|
server {
|
|
listen 80;
|
|
server_name api.*;
|
|
|
|
location / {
|
|
proxy_pass http://nanaxe_api;
|
|
proxy_http_version 1.1;
|
|
proxy_set_header Upgrade $http_upgrade;
|
|
proxy_set_header Connection 'upgrade';
|
|
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_cache_bypass $http_upgrade;
|
|
|
|
# Timeouts
|
|
proxy_connect_timeout 60s;
|
|
proxy_send_timeout 60s;
|
|
proxy_read_timeout 60s;
|
|
}
|
|
}
|
|
|
|
# Gitea Server
|
|
server {
|
|
listen 80;
|
|
server_name git.*;
|
|
|
|
location / {
|
|
proxy_pass http://gitea;
|
|
proxy_http_version 1.1;
|
|
proxy_set_header Upgrade $http_upgrade;
|
|
proxy_set_header Connection 'upgrade';
|
|
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_cache_bypass $http_upgrade;
|
|
}
|
|
}
|
|
|
|
# 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://nanaxe_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;
|
|
# }
|
|
# }
|
|
}
|