2026-02-04 03:49:11 +00:00
|
|
|
# App1 Nginx configuration
|
|
|
|
|
server {
|
|
|
|
|
listen 80;
|
|
|
|
|
server_name _;
|
|
|
|
|
|
|
|
|
|
root /var/www/app1;
|
|
|
|
|
index index.html;
|
|
|
|
|
|
2026-02-04 05:40:03 +00:00
|
|
|
# Main page
|
2026-02-04 03:49:11 +00:00
|
|
|
location / {
|
|
|
|
|
try_files $uri $uri/ =404;
|
|
|
|
|
}
|
|
|
|
|
|
2026-02-04 05:40:03 +00:00
|
|
|
# Nginx status for monitoring
|
2026-02-04 03:49:11 +00:00
|
|
|
location /status {
|
|
|
|
|
stub_status on;
|
|
|
|
|
access_log off;
|
|
|
|
|
allow 127.0.0.1;
|
|
|
|
|
allow 192.168.0.0/24;
|
|
|
|
|
deny all;
|
|
|
|
|
}
|
|
|
|
|
|
2026-02-04 05:40:03 +00:00
|
|
|
# Alternative status endpoint
|
2026-02-04 03:49:11 +00:00
|
|
|
location /nginx_status {
|
|
|
|
|
stub_status on;
|
|
|
|
|
access_log off;
|
|
|
|
|
allow 127.0.0.1;
|
|
|
|
|
allow 192.168.0.0/24;
|
|
|
|
|
deny all;
|
|
|
|
|
}
|
2026-02-04 05:40:03 +00:00
|
|
|
|
|
|
|
|
# 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"}';
|
|
|
|
|
}
|
2026-02-04 03:49:11 +00:00
|
|
|
}
|