Q:

nginx + slim configure for mutliple web service files

Can someone help me with a rewrite rule for nginx?
Using nginx+php+slim I am looking to create a web service with a large library which I would like to break up:
/
-/ws
-/ws/login.php
-/ws/services.php
-/ws/products.php

I need clean urls:
http://<domain>/login/myname/mypassword 
http://<domain>/services/myaccount/startdate/enddate
...

My problem is my Slim ws must have settings that do not allow it to be moved easily:
get(/ws/services/hello/:, function() { ....
I am looking for an easier way so that my web services set up as:
get(/hello/:name, function() { ....
Can someone help me with a rewrite rule for nginx.  I guess I'd rather add a new rewrite rule to nginx that have to update all my web services in the future if I change the installed directory.
TIA

A:

If I understand your question correctly, you should be able to solve your problem with Slim's Route Groups without the need for rewriting in nginx. For example:
$app->group('/ws/services', function () use ($app) {
    $app->get('/hello/:name', function () {});
});

You'll be able to access the Hello route like /ws/services/hello/bob.

