75 lines
2.6 KiB
Nginx Configuration File
75 lines
2.6 KiB
Nginx Configuration File
# ─────────────────────────────────────────────────────────────
|
|
# WASL — Nginx main config
|
|
# Hardened reverse proxy in front of Laravel Octane (Swoole)
|
|
# ─────────────────────────────────────────────────────────────
|
|
|
|
user nginx;
|
|
worker_processes auto;
|
|
worker_rlimit_nofile 65535;
|
|
|
|
error_log /var/log/nginx/error.log warn;
|
|
pid /var/run/nginx.pid;
|
|
|
|
events {
|
|
worker_connections 4096;
|
|
multi_accept on;
|
|
use epoll;
|
|
}
|
|
|
|
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" '
|
|
'rt=$request_time urt=$upstream_response_time';
|
|
access_log /var/log/nginx/access.log main;
|
|
|
|
# ── Performance ──
|
|
sendfile on;
|
|
tcp_nopush on;
|
|
tcp_nodelay on;
|
|
keepalive_timeout 65;
|
|
keepalive_requests 1000;
|
|
types_hash_max_size 2048;
|
|
server_tokens off;
|
|
|
|
# ── Client body limits (KYC docs up to ~10MB) ──
|
|
client_max_body_size 15m;
|
|
client_body_buffer_size 128k;
|
|
client_body_timeout 30s;
|
|
client_header_timeout 30s;
|
|
|
|
# ── Gzip ──
|
|
gzip on;
|
|
gzip_vary on;
|
|
gzip_min_length 1024;
|
|
gzip_proxied any;
|
|
gzip_comp_level 6;
|
|
gzip_types text/plain text/css application/json application/javascript text/xml application/xml application/xml+rss text/javascript;
|
|
|
|
# ── Security headers ──
|
|
server_tokens off;
|
|
add_header X-Frame-Options "DENY" always;
|
|
add_header X-Content-Type-Options "nosniff" always;
|
|
add_header X-XSS-Protection "1; mode=block" always;
|
|
add_header Referrer-Policy "strict-origin-when-cross-origin" always;
|
|
add_header Permissions-Policy "geolocation=(), microphone=(), camera=()" always;
|
|
add_header Strict-Transport-Security "max-age=63072000; includeSubDomains; preload" always;
|
|
|
|
# ── Rate limiting zones ──
|
|
limit_req_zone $binary_remote_addr zone=api:10m rate=30r/s;
|
|
limit_req_zone $binary_remote_addr zone=login:10m rate=5r/m;
|
|
limit_req_zone $binary_remote_addr zone=transfer:10m rate=10r/m;
|
|
|
|
# ── Upstream to Octane (Swoole) ──
|
|
upstream wasl_octane {
|
|
server app:8000 max_fails=3 fail_timeout=5s;
|
|
keepalive 64;
|
|
}
|
|
|
|
include /etc/nginx/conf.d/*.conf;
|
|
}
|