0

I use cakephp for my projects.I have made local dns in etc/hosts for folders in /var/sites.My nginx config looks like

    location /{
        add_header 'Access-Control-Allow-Origin' '*';
        add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS';
        root /var/sites/$host/app/webroot;
        index  index.php index.html;
    }

In cakephp 3.x the location of index.php is /var/sites/$host/webroot.How can I handle the scenario for multiple locations of index.php in different projects.

1 Answers1

1

Define as many location blocks as you need

location /app1/ {
    add_header 'Access-Control-Allow-Origin' '*';
    add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS';
    root /var/sites/$host/app1/webroot;
    index  index.php index.html;
}

location /app2/ {
    add_header 'Access-Control-Allow-Origin' '*';
    add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS';
    root /var/sites/$host/app2/webroot;
    index  index.php index.html;
}
Tim
  • 30,383
  • 6
  • 47
  • 77