Skip to content

Instantly share code, notes, and snippets.

@astranavt
Forked from roman01la/nginx.conf
Last active February 22, 2023 03:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save astranavt/61a55cffb967661331a8752f2d5a1e84 to your computer and use it in GitHub Desktop.
Save astranavt/61a55cffb967661331a8752f2d5a1e84 to your computer and use it in GitHub Desktop.
Node.js Express Nginx
server {
listen 80;
server_name example.com;
location / {
proxy_pass http://127.0.0.1:3000;
}
location ~ ^/(images/|scripts/|styles/|robots.txt|humans.txt|favicon.ico) {
root /your/app/public/folder;
access_log off;
expires max;
}
}
/* Turn off Express static middleware, get rid of this line */
server.use(express.static(path.join(__dirname, 'public')));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment