server {
    listen 80;
    index index.html index.php;
    server_name mpc;
    error_log  /var/log/nginx/first_error.log;
    root /var/www/first.loc;

    # location ~* /(tsd) {
    #     root   /var/www/first.loc/dist;
    #     try_files $uri $uri/ /index.html;
    #  }

    location / {
        root   /var/www/first.loc/dist;
        try_files $uri $uri/ /index.html;
    }




     location ~* \.(js|css|ico)$ {
            root /var/www/first.loc/dist;
            expires 30d;
     }

     location ~* /(fonts|images) {
            root /var/www/first.loc/dist;
            expires 30d;
     }

     location ~* /api/tmp {
          root /var/www/first.loc;
          expires 30d;
     }

    location ~ \.jpg$ {
        try_files $uri /api/image-processor.php?file=$uri;
    }
    location ~ \.png$ {
        try_files $uri /api/image-processor.php?file=$uri;
    }
     location ~* /api {
        fastcgi_split_path_info ^(.+\.php)(/.+)$;
        # контейнер php-fpm
        #fastcgi_pass 127.0.0.1:9000;
        fastcgi_pass php-backend-tsd:9000;
        fastcgi_index index.php;
        fastcgi_read_timeout 1000;
        include fastcgi_params;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
        fastcgi_param PATH_INFO $fastcgi_path_info;
    }

    location ~ \.php$ {
        fastcgi_split_path_info ^(.+\.php)(/.+)$;
        # контейнер php-fpm
        #fastcgi_pass 127.0.0.1:9000;
        fastcgi_pass php-backend-tsd:9000;
        fastcgi_index index.php;
        fastcgi_read_timeout 1000;
        include fastcgi_params;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
        fastcgi_param PATH_INFO $fastcgi_path_info;
    }



}
