Deploying nodejs app using npx http-server and Nginx
You are mixing serving Javascript files to the browser and serving node.js app as a backend application.
It seems that your node.js app (npx http-server
) is an HTTP server itself and it serves your static files to the browser. You don't need to run npx http-server
behind nginx
if you only need to serve static files to a client browser.
But if you need to run a real node.js app then you can't just drop it into nginx
root folder as nginx
can serve directly only static files and you need to use something like proxy_pass
with backend apps.