Search code examples
macosrestnginxtonic

nginx conf for tonic rest with multiple sites on mac


i try to config nginx with tonic rest for multiple sites on my mac. My nginx runs as localhost on my mac.

My root is /Users/thorsten/Sites

In root i habe some projects e.g. /project1, /project2

Each project has the tonic rest folder /standard/rest...

In nginx.conf i try

location /rest/ {
        fastcgi_pass_header Authorization;         # Pass the http authorization parameter to the PHP script
        if (!-e $request_filename) {
                rewrite ^/(.*)$ /rest/dispatch.php?/$1 last;
                break;
        }
    }

Nothing happend. Do i need a config for each project or can i have a global config for all project e.g. $project/rest/...?


Solution

  • This config works for me

      location ~ ^/(?<project>.+)/standard/rest/ {
        fastcgi_pass_header Authorization;
        include   /usr/local/etc/nginx/conf.d/php-fpm;
    
        if (!-e $request_filename) {
                rewrite ^/(.*)$ /$project/standard/rest/dispatch.php?/$1 last;
                break;
        }
    }