title: How to use nginx for nuxt js as proxy and http server?
body: <p>I have a NUXT js application on Ubuntu 20.04 Server. I used Nginx to serve my nuxt application as follow:</p>
  <pre><code>server {
  client_max_body_size 300M;
  
  root /var/www/app/dist;
  
  server_name example.com;
  
  location / {
          proxy_pass http://localhost:8080;
          proxy_http_version 1.1;
          proxy_set_header Upgrade $http_upgrade;
          proxy_set_header Connection 'upgrade';
          proxy_set_header Host $host;
          proxy_cache_bypass $http_upgrade;
  }
  </code></pre>
  <p>My NUXT application works with npm on port 8080 and Nginx reverse proxy, passes user requests to localhost:8080 and everything is working fine.</p>
  <p>Now I want to access the js service worker file (named: p-sw.js). but when I try to access it via my website address, (<a href="https://example.com/p-sw.js" rel="nofollow noreferrer">https://example.com/p-sw.js</a>) due to Nginx reverse proxy it returns 404. This file is in the dist folder (see Nginx configuration).</p>
  <p>Anybody can explain to me how to set Nginx reverse proxy to works fine as before alongside load service worker file when I enter service worker address (<a href="https://example.com/p-sw.js" rel="nofollow noreferrer">https://example.com/p-sw.js</a>) in browser?</p>