0

I’m hosting a Node.js Wiki server (openKB) on /wiki behind an Nginx server. How can I proxy_pass from Nginx while also having Nginx serve static assets hosted at /wiki/public and /wiki/images and /wiki/stylesheets/build and so on.

What I had tried but did not work:

location /wiki {
        proxy_pass http://127.0.0.1:4444;
        proxy_redirect off;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-NginX-Proxy true;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection 'upgrade';
        proxy_set_header Host $host;
        proxy_cache_bypass $http_upgrade;
}

EDIT:

Site: dffrnt.com/wiki

Output: enter image description here While the app runs just fine, the static assets are not getting served at all. I noticed some of the assets are 404 while some others are 503.

Here’s what’s on the server...

enter image description here

vjk2005
  • 175
  • 1
  • 2
  • 8
  • Please clarify the exact URLs and respective file system paths in your question. Please also clarify "did not work". What exactly you expected to happen and what happened instead? – Tero Kilkanen Mar 16 '17 at 13:15
  • Possible duplicate of [Nginx: bug using if in location, how do I rectify](http://serverfault.com/questions/282485/nginx-bug-using-if-in-location-how-do-i-rectify) – Hakuno Mar 16 '17 at 14:06
  • @TeroKilkanen thank you for your patience, I hope the details I have added are useful to diagnose the problem. – vjk2005 Mar 16 '17 at 14:23
  • Try swapping the two locations – Christopher Perrin Mar 16 '17 at 15:15
  • @ChristopherPerrin I think the second location was a mistake on my part, it served no purpose in the final app, I have removed it now. Thanks for turning my attention onto it. – vjk2005 Mar 16 '17 at 15:32
  • Why don't you add a location for the longer path (possibly before the /wiki location)? – allo Mar 16 '17 at 23:48

0 Answers0