需求是http://IP/XXX/dist/index.html的URL中XXX为任意字符都转发到http://IP/dist/index.html
location ~ ^/(.)/dist/(.*)$ {
rewrite /(.)/dist/(.)$ /dist/$2 break;
proxy_pass http://$switch;
access_log /alidata1/logs/nginx/localhost_dist_access.log ZAWEB;
转载于:https://blog.51cto.com/gavin0/2287793