Skip to content

Instantly share code, notes, and snippets.

@pastuhov
Last active October 15, 2025 13:30
Show Gist options
  • Save pastuhov/2d3ce915903f36be0b35eddbef2bb866 to your computer and use it in GitHub Desktop.
Save pastuhov/2d3ce915903f36be0b35eddbef2bb866 to your computer and use it in GitHub Desktop.
Simple mock web server with a delayed response
services:
nginx:
image: openresty/openresty:alpine
ports:
- "8080:80"
volumes:
- ./nginx.conf:/usr/local/openresty/nginx/conf/nginx.conf:ro
worker_processes 1;
events {
worker_connections 100;
}
http {
server {
listen 80;
server_name _;
location = /one {
echo_sleep 1;
echo '{"url":"one","status":"ok"}';
add_header Content-Type application/json;
}
location = /two {
echo_sleep 2;
echo '{"url":"two","status":"ok"}';
add_header Content-Type application/json;
}
location = /three {
echo_sleep 3;
echo '{"url":"three","status":"ok"}';
add_header Content-Type application/json;
}
location = / {
return 200 "nginx up";
add_header Content-Type text/plain;
}
# healthcheck
location = /health {
return 200 "ok";
add_header Content-Type text/plain;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment