It's possible to use regex, such as: location ~ ^/(?<type>[^/]+)/ { proxy_pass http://127.0.0.1:8080/$type/; } BUT two static (non-regex) locations are faster. Andrejs Posted at Nginx Forum: http://forum.nginx.org/read.php?2,228898,229038#msg-229038