~$ sudo vi /etc/nginx/nginx.conf
events { worker_connections 1024; }
http {
# List of application servers
upstream backend-alb {
server 127.0.0.1:5001;
server 127.0.0.1:5002;
server 127.0.0.1:5003;
}
# Configuration for the server
server {
# Running port
listen 80 default_server;
# Proxying the connections
location / {
proxy_pass http://backend-alb;
}
}
}
~$ sudo systemctl restart nginx.service
~$ sudo systemctl status nginx.service
nginx container reverse proxy 구성
docker run -d -p 8001:80 --name=proxy-container nginx:1.25.0-alpine
~$ vi nginx.conf
events { worker_connections 1024; }
http {
upstream backend-alb {
server 192.168.56.101:5001;
server 192.168.56.101:5002;
server 192.168.56.101:5003;
}
server {
listen 80 default_server;
location / {
proxy_pass http://backend-alb;
}
}
}
~$ docker cp nginx.conf proxy-container:/etc/nginx/nginx.conf
댓글 남기기