Nginx serve different files based on user login?
Only application could check if user is logged in or not, but you could use X-Accel-Redirect
header to make nginx serve one file or another.
Some pseudocode:
if (user.isLoggedIn) { response.setHeader("X-Accel-Redirect", "/app.html");} else { response.setHeader("X-Accel-Redirect", "/index.html");}response.end();
Also you need to pass request to /
to application.
location = / { # copy from location /api}