On Apache-based servers PNFPB serves the service worker JS file and PWA manifest dynamically via WordPress rewrite rules. On NGINX these rewrites do not work by default, and the files may return 404.
The Problem on NGINX
The service worker URL must be at the root path of your domain (e.g. https://yoursite.com/pnfpb_icpush_pwa_sw.js) for the browser to grant it the required origin scope for push notifications. NGINX typically does not forward such requests to PHP/WordPress unless you add explicit rules.
Enable NGINX Static File Creation
- Go to PNFPB → Settings for NGINX server.
- Enable the Create static service worker for NGINX option.
- Save settings.
PNFPB will write two physical files to your web root:
{ABSPATH}/pnfpb_icpush_pwa_sw.js– the complete push notification + PWA service worker.{ABSPATH}/pnfpbmanifest.json– the PWA manifest.
www-data) needs write access to the web root directory for this option to work. On shared hosting this is usually the case; on hardened VPS setups you may need to chmod the directory temporarily.
When These Files Need Updating
Any time you change PWA settings (icon, name, cache URLs) or Firebase credentials the static files need to be regenerated. Saving the settings with the NGINX option enabled automatically regenerates the files.
Disabling the Service Worker
If you want to turn off all browser push and PWA entirely (e.g. you only use the REST API for mobile apps), enable “Disable push notification service worker file and PWA”. This deletes the static files and prevents frontend push scripts from being enqueued.