My Sites


Saturday, July 2, 2016

Nginx - Proxy to Express Application, Load Balancer, Static Cache Files

sudo apt-get update
sudo apt-get install nginx
sudo service nginx start 
sudo service nginx stop
nano /etc/nginx/site_enabled/default

upstream project {
server 33.22.22.5:3000;
server 33.22.22.6:3000;
server 33.22.22.7:3000;
}
server {
listen 80;
location / {
proxy_pass http://project;
}
location ~* \.(css|js|gif|jpe?g|png)$ {
expires 168h;
}
location /api {
expires 10m;
}
}

How add an automatic load to the server (Performance wise check)
Bench test for 1000 requests
ab -c 40 -n 1000 http://33.22.22.5/

No comments:

Post a Comment