-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathnginx.txt
43 lines (32 loc) · 1021 Bytes
/
nginx.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
LOAD BALANCING
- Within the folder where docker project is
sudo apt-get install nginx
sudo apt-get install apache2-utils
docker build -t flaskapp5 .
docker run -d -p 5001:5000 flaskapp5
docker run -d -p 5002:5000 flaskapp5
docker run -d -p 5003:5000 flaskapp5
ab -n 1000 -c 100 http://localhost:5001/ (takes more time)(optional)
Enter code:
- sudo nano /etc/nginx/nginx.conf
sudo chmod o+w /etc/nginx/nginx.conf
sudo rm /etc/nginx/sites-enabled/default
sudo nginx -t
sudo systemctl restart nginx
curl http://localhost/
ab -n 1000 -c 100 http://localhost/ (takes lesser time)
docker logs containerID
When a text editor opens, enter code:
http {
upstream flaskapp { /// flaskapp is the folder name
server localhost:5001;
server localhost:5002;
server localhost:5003;
}
server {
listen 80;
location / {
proxy_pass http://flaskapp; /// flaskapp is the folder name
}
}
}