Учебные материалы 📑

M2 Задание 9-10.txt

===ISP===

apt-get update && apt-get install nginx -y

vim /etc/nginx/sites-available.d/r-proxy.conf

====
server {
listen 80;
server_name web.au-team.irpo;
location / {
proxy_pass http://172.16.1.10:8081;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
auth_basic "Restricted Access";
auth_basic_user_file /etc/nginx/.htpasswd;
}
}
server {
listen 80;
server_name docker.au-team.irpo;
location / {
proxy_pass http://172.16.2.10:8081;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
}
}
====

ln -s /etc/nginx/sites-available.d/r-proxy.conf /etc/nginx/sites-enabled.d/

nginx -t

systemctl enable --now nginx

systemctl status nginx

=======================================

apt-get install apache2-htpasswd -y

htpasswd -c /etc/nginx/.htpasswd Khariton
# Вводим пароль P@ssw0rd (2 раза)

cat /etc/nginx/.htpasswd

nginx -t

systemctl restart nginx


=======================================
Переходим на HQ-CLI, заходим по http://web.au-team.irpo/
Логин: Khariton
Пароль: P@ssw0rd

Дальше заходим по http://docker.au-team.irpo/

Если всё открывается, значит задание выполнено верно.