Skip to content

Instantly share code, notes, and snippets.

@chy168
Created October 28, 2014 03:53
Show Gist options
  • Star 4 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save chy168/42ba0408a26bf14f75c4 to your computer and use it in GitHub Desktop.
Save chy168/42ba0408a26bf14f75c4 to your computer and use it in GitHub Desktop.
#user nobody;
worker_processes 1;
#error_log logs/error.log;
#error_log logs/error.log notice;
#error_log logs/error.log info;
error_log /tmp/nginx_debug_error.log debug;
#pid logs/nginx.pid;
events {
worker_connections 1024;
}
http {
default_type application/octet-stream;
sendfile on;
keepalive_timeout 65;
access_log /tmp/access.log;
error_log /tmp/error.log;
server {
listen 8888;
server_name localhost;
# Start test
# 差別尾巴'/'
# http://localhost:8888/eee/XYZ1
# http://localhost:8888/eee/XYZ1asdf
location ~ /eee/XYZ[0-9] {
echo "F";
}
# http://localhost:8888/eee/ABC2
location ~ /eee/ABC[0-9]/ {
echo "E";
}
# Cannot Match, due to ^~ > ~
location ~ /test/[xyz]ABC {
echo "D";
}
# http://localhost:8888/test/XYZ
# http://localhost:8888/test/XYZ123
location ^~ /test/XYZ {
echo "C";
}
# http://localhost:8888/test/
# http://localhost:8888/test/XY
# http://localhost:8888/testAAAA
location ^~ /test {
# /login OK
# /login/ Not OK
echo "2";
}
# http://localhost:8888/te
location = /te {
# 只有 / 可以
echo "1";
}
location / {
echo "All";
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment