How to proxy_pass to my app. But file not found 404!!

Posted November 8, 2017 8.1k views
NginxNode.jsDigitalOceanDigitalOcean 1-Click Apps MarketplaceLEMPApplicationsDeploymentUbuntu 16.04JavaScript

I have react application (next js) run on localhost:7878. And I config nginx in location proxy_pass localhost:7878. And after that i view page source in my browser and open path file js. But can not find it.

What do i have to do?


These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Submit an Answer
2 answers

Sorry to see that your question hasn’t received an answer yet. Unfortunately, without more information, it is unlikely that an answer for this specific issue can be provided. For people still landing here via search, running a Next.js app in production is much like running any Node app. Check out this tutorial for all the details on getting a Node app running behind an Nginx reverse proxy:

by Brennen Bearnes
Node.js is an open source JavaScript runtime environment for easily building server-side and networking applications. Node.js applications can be run at the command line but this guide focuses on running them as a service using PM2, so that they will automatically restart on reboot or failure, and can safely be used in a production environment.

you need to delete other location
and put this conf
you can see image
ip finder

location / {
 proxy_set_header Host $host;