0

I am in need of some NginX expertise.

I am configuring a Safari Push Notifications web service with NginX. When the front end requests permission, the Safari agent fails to connect and fetch the push package with a 404:

NginX access log:

159.192.217.13 - - [09/Jul/2018:06:26:15 +0100] "POST /push/v2/pushPackages/web.com.domain.co HTTP/1.1" 404 56 "-" "SafariNotificationAgent (unknown version) CFNetwork/901.1 Darwin/17.6.0 (x86_64)" "-"
159.192.217.13 - - [09/Jul/2018:06:26:15 +0100] "POST /push/v1/pushPackages/web.com.domain.co HTTP/1.1" 301 185 "-" "SafariNotificationAgent (unknown version) CFNetwork/901.1 Darwin/17.6.0 (x86_64)" "-"
159.192.217.13 - - [09/Jul/2018:06:26:16 +0100] "GET /push/v1/pushPackages/web.com.domain.co HTTP/1.1" 403 169 "-" "SafariNotificationAgent (unknown version) CFNetwork/901.1 Darwin/17.6.0 (x86_64)" "-"

NginX error log:

2018/07/09 06:26:15 [error] 2774#0: *23 FastCGI sent in stderr: "Unable to open primary script: /www/data/push/v2/pushPackages/web.com.domain.co (No such file or directory)" while reading response header from upstream, client: 159.192.217.13, server: domain.com, request: "POST /push/v2/pushPackages/web.com.domain.co HTTP/1.1", upstream: "fastcgi://127.0.0.1:9000", host: "domain.com"
2018/07/09 06:26:16 [error] 2774#0: *23 directory index of "/www/data/push/v1/pushPackages/web.com.domain.co/" is forbidden, client: 159.192.217.13, server: domain.com, request: "GET /push/v1/pushPackages/web.com.domain.co/ HTTP/1.1", host: "domain.com"
2018/07/09 06:26:18 [error] 2774#0: *25 directory index of "/www/data/push/v1/log/" is forbidden, client: 159.192.217.13, server: domain.com, request: "GET /push/v1/log/ HTTP/1.1", host: "domain.com"

(replaced server with domain.com)

NginX location conf:

location /push/v2/pushPackages/web.com.domain.co {

      add_header "Access-Control-Allow-Origin"  *;


      allow all;
      fastcgi_pass 127.0.0.1:9000;
      fastcgi_index index.php;
      fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
      include fastcgi_params;          
    }

I am convinced this configuration is not correct.

It is pointing to the directory /push/v2/pushPackages/web.com.domain.co where index.php then generates the push package zip, however it appears that index cannot be found.

r018u
  • 41
  • 1
  • 5
  • Try: `fastcgi_param SCRIPT_FILENAME /www/data/push/v2/pushPackages/web.com.domain.co/index.php;` – Richard Smith Jul 09 '18 at 08:38
  • Fantastic, this worked. Can you explain how this line differs from the previous one? Will also upvote you if you submit this as the answer. Thank you Richard – r018u Jul 09 '18 at 10:24

0 Answers0