mirror of
https://github.com/nprasad2077/NBA_Go.git
synced 2026-09-22 14:05:13 +00:00
67 lines
1.9 KiB
Plaintext
67 lines
1.9 KiB
Plaintext
cat > /data/nba-go-config/nginx/nginx.conf << 'EOF'
|
|
user nginx;
|
|
|
|
events {
|
|
worker_connections 1024;
|
|
}
|
|
|
|
http {
|
|
proxy_cache_path /var/cache/nginx levels=1:2 keys_zone=api_cache:10m max_size=100m inactive=5m;
|
|
|
|
map $http_referer $blocked_referer {
|
|
default 0;
|
|
"~*nbasalarymodel\.xyz" 1;
|
|
"~*kacpertheater\.github\.io" 1;
|
|
}
|
|
|
|
upstream go_backend {
|
|
server api1:5000;
|
|
server api2:5000;
|
|
server api3:5000;
|
|
}
|
|
|
|
server {
|
|
listen 8080;
|
|
|
|
access_log /dev/stdout;
|
|
error_log /dev/stderr;
|
|
|
|
if ($blocked_referer) {
|
|
return 403;
|
|
}
|
|
|
|
location /api/ {
|
|
proxy_cache api_cache;
|
|
proxy_cache_valid 200 30s;
|
|
proxy_cache_key "$request_uri";
|
|
proxy_cache_use_stale error timeout updating;
|
|
add_header X-Cache-Status $upstream_cache_status;
|
|
|
|
proxy_pass http://go_backend;
|
|
proxy_http_version 1.1;
|
|
proxy_set_header Upgrade $http_upgrade;
|
|
proxy_set_header Connection keep-alive;
|
|
proxy_set_header Host $host;
|
|
proxy_cache_bypass $http_upgrade;
|
|
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 / {
|
|
proxy_pass http://go_backend;
|
|
proxy_http_version 1.1;
|
|
proxy_set_header Upgrade $http_upgrade;
|
|
proxy_set_header Connection keep-alive;
|
|
proxy_set_header Host $host;
|
|
proxy_cache_bypass $http_upgrade;
|
|
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;
|
|
}
|
|
}
|
|
}
|
|
EOF
|
|
|
|
docker exec 4c3368863bdc nginx -s reload
|