mac 上多个站点的 nginx conf for tonic rest

nginx conf for tonic rest with multiple sites on mac

我尝试为我的 mac 上的多个站点配置带有 tonic rest 的 nginx。 我的 nginx 在 mac.

上作为本地主机运行

我的根是/Users/thorsten/Sites

在 root 中,我有一些项目,例如/project1, /project2

每个项目都有tonic rest文件夹/standard/rest...

在nginx.conf我试试

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

什么都没发生。 我是否需要为每个项目配置一个配置,或者我可以为所有项目配置一个全局配置,例如$project/rest/...?

这个配置适合我

  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?/ last;
            break;
    }
}