Spaces:
Paused
Paused
File size: 2,956 Bytes
83a59ca edb5ea4 83a59ca edb5ea4 83a59ca | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 | worker_processes 1;
pid /tmp/nginx.pid;
error_log /var/log/nginx/error.log warn;
events {
worker_connections 1024;
}
http {
include /etc/nginx/mime.types;
default_type application/octet-stream;
# All temp paths under /tmp so non-root uid=1000 never hits permission errors
client_body_temp_path /tmp/nginx_client_body;
proxy_temp_path /tmp/nginx_proxy;
fastcgi_temp_path /tmp/nginx_fastcgi;
uwsgi_temp_path /tmp/nginx_uwsgi;
scgi_temp_path /tmp/nginx_scgi;
sendfile on;
tcp_nopush on;
keepalive_timeout 65;
server_tokens off;
# Compression: cuts the SPA payload by ~65-75%
gzip on;
gzip_vary on;
gzip_min_length 1024;
gzip_comp_level 5;
gzip_types text/plain text/css application/javascript application/json application/xml image/svg+xml;
gzip_proxied any;
upstream httpsms_api {
server 127.0.0.1:8000;
}
server {
listen 7860;
server_name _;
access_log /var/log/nginx/access.log;
# Go Fiber API: /v1/* plus heartbeat/health routes (WebSocket/SSE aware)
location ~* ^/(v1|heartbeat|health)(/|$) {
proxy_pass http://httpsms_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 https;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_read_timeout 3600s;
}
# Android APK direct download
location = /HttpSms.apk {
alias /usr/share/nginx/html/HttpSms.apk;
default_type application/vnd.android.package-archive;
add_header Content-Disposition 'attachment; filename="HttpSms.apk"';
add_header Cache-Control "public, max-age=3600";
}
# Hashed Nuxt build assets: content-addressed, cache forever
location ^~ /_nuxt/ {
root /usr/share/nginx/html;
try_files $uri =404;
add_header Cache-Control "public, max-age=31536000, immutable";
}
# Other static assets: public short cache
location ~* \.(?:css|js|svg|png|jpg|jpeg|gif|webp|ico|woff2?|ttf|eot|xlsx|csv)$ {
root /usr/share/nginx/html;
try_files $uri =404;
add_header Cache-Control "public, max-age=2592000";
}
# HTML: always revalidate so new builds propagate
location ~* \.html$ {
root /usr/share/nginx/html;
try_files $uri =404;
add_header Cache-Control "no-cache";
}
# Nuxt static SPA with client-side routing fallback
location / {
root /usr/share/nginx/html;
try_files $uri $uri/ /index.html;
}
}
}
|