0

I have an AngularJS app in /home/app/front and a PHP backend in /home/app/back. Now I would like to serve static files from / and PHP from /api/v1/

I tried the following config with no success. Nginx throws the following error message: FastCGI sent in stderr: "Primary script unknown"

server {
    listen 80;

    server_name localhost;

    location / {
        root /usr/share/nginx/html/wpplugins/frontend;
        try_files $uri $uri/ /index.html;
    }

    location ^~ /api/v1/ {
        root /usr/share/nginx/html/wpplugins/backend;
        try_files $uri $uri/ /index.php?_url=$request_uri;
    }

    location ~ \.php {
        fastcgi_index /index.php;
        fastcgi_pass unix:/var/run/php5-fpm.sock;

        include /etc/nginx/fastcgi_params;

        fastcgi_split_path_info       ^(.+\.php)(/.+)$;
        fastcgi_param PATH_INFO       $fastcgi_path_info;
        fastcgi_param PATH_TRANSLATED $document_root$fastcgi_path_info;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
    }
}
Aley
  • 209
  • 2
  • 4
  • 16

0 Answers0