Created
October 20, 2024 20:38
-
-
Save arsalanses/18f6483f265d30f36f6735c8756995fd to your computer and use it in GitHub Desktop.
nginx mirror
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
upstream backend { | |
server echo01:5678; | |
} | |
upstream test_backend { | |
server echo02:5678; | |
} | |
server { | |
server_name 192.168.0.100; | |
listen 80; | |
access_log /var/log/nginx/proxy.log; | |
error_log /var/log/nginx/proxy.error.log info; | |
location / { | |
mirror /mirror; | |
proxy_pass http://backend; | |
} | |
location = /mirror { | |
internal; | |
proxy_pass http://test_backend$request_uri; | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
services: | |
nginx: | |
image: docker.arvancloud.ir/nginx:latest | |
container_name: nginx | |
ports: | |
- "80:80" | |
volumes: | |
# - ./nginx.conf:/etc/nginx/nginx.conf | |
- ./default.conf:/etc/nginx/conf.d/default.conf | |
echo01: | |
image: docker.arvancloud.ir/hashicorp/http-echo:latest | |
command: -text="echo01" | |
container_name: echo01 | |
echo02: | |
image: docker.arvancloud.ir/hashicorp/http-echo:latest | |
command: -text="echo02" | |
container_name: echo02 | |
# docker run -it --rm --network nginx_default docker.arvancloud.ir/ricoli/hey:latest -z 10s -q 100 -n 1000 -c 1 -t 1 http://nginx |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
docker compose exec nginx nginx -t | |
docker compose exec nginx nginx -s reload |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment