Skip to content

Instantly share code, notes, and snippets.

@learncodeacademy
Created July 24, 2014 14:47
Show Gist options
  • Star 72 You must be signed in to star a gist
  • Fork 30 You must be signed in to fork a gist
  • Save learncodeacademy/ebba574fc3f438c851ae to your computer and use it in GitHub Desktop.
Save learncodeacademy/ebba574fc3f438c851ae to your computer and use it in GitHub Desktop.
Nginx Node Frontend / Load Balancer / Static Assets Caching
upstream project {
server 22.22.22.2:3000;
server 22.22.22.3:3000;
server 22.22.22.5:3000;
}
server {
listen 80;
location / {
proxy_pass http://project;
}
location ~* \.(css|js|gif|jpe?g|png)$ {
expires 168h;
}
location /api {
expires 10m;
}
}
@basedalexander
Copy link

SOLVED

The issue was because of default conf file in sites-available, just delete or rename it and you good to go.

@mustafa05deniz
Copy link

if something is wrong try like this

location ~ ^/views/((css|js|gif|jpe?g|png).*)$ {
expires 168h;

}

@Vinayk93
Copy link

can you please write this code in apache also.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment