# Paste into the listen 443 (and 80) server {} in /etc/nginx/conf.d/apps.conf
# Replaces old per-URL blocks + any backend symlink paths.

  location = /app/androidcast_project/crashes {
    return 301 /app/androidcast_project/crashes/;
  }

  location = /app/androidcast_project/graphs {
    return 301 /app/androidcast_project/graphs/;
  }

  location = /app/androidcast_project {
    return 301 /app/androidcast_project/;
  }

  # Hub — see nginx.apps-port80.fragment (index.php + shared footer).
  location = /app/androidcast_project/index.php {
    include fastcgi_params;
    fastcgi_pass unix:/run/php-fpm.socket;
    fastcgi_param SCRIPT_FILENAME /var/www/localhost/htdocs/apps/app/androidcast_project/index.php;
    fastcgi_param SCRIPT_NAME /app/androidcast_project/index.php;
  }

  location = /app/androidcast_project/ {
    rewrite ^ /app/androidcast_project/index.php last;
  }

  location /app/androidcast_project/ {
    alias /var/www/localhost/htdocs/apps/app/androidcast_project/;
    index index.php index.html;
    try_files $uri $uri/ =404;
  }

  location ^~ /app/androidcast_project/crashes/assets/ {
    alias /var/www/localhost/htdocs/apps/app/androidcast_project/android_cast/examples/crash_reporter/backend/public/assets/;
  }

  location = /app/androidcast_project/crashes/api/upload.php {
    include fastcgi_params;
    fastcgi_pass unix:/run/php-fpm.socket;
    fastcgi_param SCRIPT_FILENAME /var/www/localhost/htdocs/apps/app/androidcast_project/android_cast/examples/crash_reporter/backend/public/api/upload.php;
    fastcgi_param SCRIPT_NAME /app/androidcast_project/crashes/api/upload.php;
    fastcgi_param REQUEST_URI $request_uri;
    client_max_body_size 4m;
  }

  location = /app/androidcast_project/crashes/api/diag.php {
    include fastcgi_params;
    fastcgi_pass unix:/run/php-fpm.socket;
    fastcgi_param SCRIPT_FILENAME /var/www/localhost/htdocs/apps/app/androidcast_project/android_cast/examples/crash_reporter/backend/public/api/diag.php;
    fastcgi_param SCRIPT_NAME /app/androidcast_project/crashes/api/diag.php;
    fastcgi_param REQUEST_URI $request_uri;
  }

  location = /app/androidcast_project/crashes/api/reports.php {
    include fastcgi_params;
    fastcgi_pass unix:/run/php-fpm.socket;
    fastcgi_param SCRIPT_FILENAME /var/www/localhost/htdocs/apps/app/androidcast_project/android_cast/examples/crash_reporter/backend/public/api/reports.php;
    fastcgi_param SCRIPT_NAME /app/androidcast_project/crashes/api/reports.php;
    fastcgi_param REQUEST_URI $request_uri;
  }

  location = /app/androidcast_project/crashes/api/report_viewed.php {
    include fastcgi_params;
    fastcgi_pass unix:/run/php-fpm.socket;
    fastcgi_param SCRIPT_FILENAME /var/www/localhost/htdocs/apps/app/androidcast_project/android_cast/examples/crash_reporter/backend/public/api/report_viewed.php;
    fastcgi_param SCRIPT_NAME /app/androidcast_project/crashes/api/report_viewed.php;
    fastcgi_param REQUEST_URI $request_uri;
  }

  location = /app/androidcast_project/crashes/api/report_tags.php {
    include fastcgi_params;
    fastcgi_pass unix:/run/php-fpm.socket;
    fastcgi_param SCRIPT_FILENAME /var/www/localhost/htdocs/apps/app/androidcast_project/android_cast/examples/crash_reporter/backend/public/api/report_tags.php;
    fastcgi_param SCRIPT_NAME /app/androidcast_project/crashes/api/report_tags.php;
    fastcgi_param REQUEST_URI $request_uri;
  }

  location ^~ /app/androidcast_project/crashes/ {
    include fastcgi_params;
    fastcgi_pass unix:/run/php-fpm.socket;
    fastcgi_param SCRIPT_FILENAME /var/www/localhost/htdocs/apps/app/androidcast_project/android_cast/examples/crash_reporter/backend/public/index.php;
    fastcgi_param SCRIPT_NAME /app/androidcast_project/crashes/index.php;
    fastcgi_param REQUEST_URI $request_uri;
    client_max_body_size 4m;
  }

  location = /app/androidcast_project/graphs/api/graphs.php {
    include fastcgi_params;
    fastcgi_pass unix:/run/php-fpm.socket;
    fastcgi_param SCRIPT_FILENAME /var/www/localhost/htdocs/apps/app/androidcast_project/android_cast/examples/crash_reporter/backend/public/api/graphs.php;
    fastcgi_param SCRIPT_NAME /app/androidcast_project/graphs/api/graphs.php;
    fastcgi_param REQUEST_URI $request_uri;
  }

  location = /app/androidcast_project/graphs/api/graph_upload.php {
    include fastcgi_params;
    fastcgi_pass unix:/run/php-fpm.socket;
    fastcgi_param SCRIPT_FILENAME /var/www/localhost/htdocs/apps/app/androidcast_project/android_cast/examples/crash_reporter/backend/public/api/graph_upload.php;
    fastcgi_param SCRIPT_NAME /app/androidcast_project/graphs/api/graph_upload.php;
    fastcgi_param REQUEST_URI $request_uri;
    client_max_body_size 4m;
  }

  location ^~ /app/androidcast_project/graphs/ {
    include fastcgi_params;
    fastcgi_pass unix:/run/php-fpm.socket;
    fastcgi_param SCRIPT_FILENAME /var/www/localhost/htdocs/apps/app/androidcast_project/android_cast/examples/crash_reporter/backend/public/index.php;
    fastcgi_param SCRIPT_NAME /app/androidcast_project/graphs/index.php;
    fastcgi_param REQUEST_URI $request_uri;
    client_max_body_size 4m;
  }
