Добавлена конфигурация мониторинга Nginx и финальные правки для app1

This commit is contained in:
Freazzzing
2026-02-04 05:40:03 +00:00
parent b1fc6bcf3c
commit 14d945e7b5
9 changed files with 657 additions and 35 deletions

View File

@ -6,10 +6,12 @@ server {
root /var/www/app1;
index index.html;
# Main page
location / {
try_files $uri $uri/ =404;
}
# Nginx status for monitoring
location /status {
stub_status on;
access_log off;
@ -18,6 +20,7 @@ server {
deny all;
}
# Alternative status endpoint
location /nginx_status {
stub_status on;
access_log off;
@ -25,4 +28,45 @@ server {
allow 192.168.0.0/24;
deny all;
}
# Test endpoints for load generation
location /api/test {
add_header Content-Type application/json;
add_header Cache-Control "no-cache";
return 200 '{"status": "ok", "timestamp": "$time_iso8601", "server": "app1", "request_id": "$request_id", "method": "$request_method"}';
}
location /api/slow {
add_header Content-Type application/json;
add_header Cache-Control "no-cache";
# Simple JSON response
return 200 '{"status": "slow_endpoint", "message": "Endpoint for testing", "timestamp": "$time_iso8601"}';
}
location /api/error {
add_header Content-Type application/json;
add_header Cache-Control "no-cache";
# Simple error endpoint
return 500 '{"status": "error", "code": 500, "message": "Test error response", "request_id": "$request_id"}';
}
location /api/random {
add_header Content-Type application/json;
add_header Cache-Control "no-cache";
# Random response - always success but different messages
return 200 '{"status": "random", "timestamp": "$time_iso8601", "value": "$msec", "message": "Random endpoint response"}';
}
location /api/metrics {
add_header Content-Type application/json;
add_header Cache-Control "no-cache";
return 200 '{"server": "app1", "timestamp": "$time_iso8601", "available_endpoints": ["/api/test", "/api/slow", "/api/error", "/api/random", "/api/metrics", "/health", "/status"]}';
}
# Health check endpoint
location /health {
add_header Content-Type application/json;
access_log off;
return 200 '{"status": "healthy", "service": "nginx", "timestamp": "$time_iso8601", "version": "$nginx_version"}';
}
}