Skip to content

Instantly share code, notes, and snippets.

@halfcrazy
Created March 17, 2018 18:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save halfcrazy/1f7e294ae66207cd96decdeaa0f70340 to your computer and use it in GitHub Desktop.
Save halfcrazy/1f7e294ae66207cd96decdeaa0f70340 to your computer and use it in GitHub Desktop.
worker_processes 1;
error_log logs/error.log;
pid logs/nginx.pid;
worker_rlimit_nofile 8192;
events {
worker_connections 4096; ## Default: 1024
}
http {
index index.html index.htm index.php;
default_type application/octet-stream;
log_format main '$remote_addr - $remote_user [$time_local] $status '
'"$request" $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';
access_log logs/access.log main;
sendfile on;
tcp_nopush on;
server {
listen 80;
access_log logs/80.access.log main;
root html;
location ~ /aaa/(.*) {
proxy_pass http://127.0.0.1:81/$1;
}
location ~ /bbb/(.*) {
proxy_pass http://127.0.0.1:82/$1;
}
location ~ /ccc/(.*) {
proxy_pass http://127.0.0.1:83/$1;
}
}
server {
listen 81;
access_log logs/81.access.log main;
root static_a;
}
server {
listen 82;
access_log logs/82.access.log main;
root static_b;
}
server {
listen 83;
access_log logs/83.access.log main;
root static_c;
}
}
@halfcrazy
Copy link
Author

halfcrazy commented Mar 17, 2018

mkdir static_a static_b static_c
echo a > static_a/a.txt
echo b > static_b/b.txt
echo c > static_c/c.txt

curl http://127.0.0.1:80/aaa/a.txt
curl http://127.0.0.1:80/bbb/b.txt
curl http://127.0.0.1:80/ccc/c.txt

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment