Skip to content

Instantly share code, notes, and snippets.

@roman01la
Last active May 18, 2019 07:00
Show Gist options
  • Star 6 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save roman01la/06f0cfef2b53ff609f89 to your computer and use it in GitHub Desktop.
Save roman01la/06f0cfef2b53ff609f89 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