1. Это временное решение, когда будет совершён переход на Carbon PL5 Linux всё будет работать немного иначе.
2. Список администраторов из веб-интерфейса нужно будет добавлять в конфиг руками.
{code}
htpasswd -bc '/usr/local/Reductor/userinfo/hooks/nginx_htpasswd' 'admin' 'yourpassword'
{code}
Конфиг необходимо разместить в папке с хуками /usr/local/Reductor/userinfo/hooks/nginx_reductor.conf:
{code}
# Configuration for Nginx
server {
listen 10.50.140.230:8080;
# Serve a static file (ex. favico) outside static dir.
location = /favico.ico {
root /app/favico.ico;
}
# Proxying connections to application servers
allow 10.50.140.222;
deny all;
location / {
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $remote_addr;
proxy_set_header Host $host;
proxy_pass http://127.0.0.1:8085;
}
}
{code}
Добавляем htpasswd:
{code}
# Configuration for Nginx
server {
listen 10.50.140.230:8080;
# Serve a static file (ex. favico) outside static dir.
location = /favico.ico {
root /app/favico.ico;
}
# Proxying connections to application servers
allow 10.50.140.222;
deny all;
location / {
auth_basic "Not Found 404"; # текст сообщения сервера с предложением ввести пароль
auth_basic_user_file /usr/local/Reductor/userinfo/hooks/nginx_htpasswd; # путь к htpasswd файлу
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $remote_addr;
proxy_set_header Host $host;
proxy_pass http://127.0.0.1:8085;
}
}
{code}
Создаём хук /usr/local/Reductor/userinfo/hooks/start.sh
{code}
#!/bin/bash
client_post_start_hook() {
echo "- Включаем basic auth в nginx"
cp -a $HOOKDIR/nginx_reductor.conf /etc/nginx/conf.d/
service nginx reload || service nginx restart || true
}
{code}
Делаем его исполняемым:
{code}
chmod a+x /usr/local/Reductor/userinfo/hooks/start.sh
{code}
Применяем всё что мы сделали:
{code}
service reductor restart
{code}
2. Список администраторов из веб-интерфейса нужно будет добавлять в конфиг руками.
{code}
htpasswd -bc '/usr/local/Reductor/userinfo/hooks/nginx_htpasswd' 'admin' 'yourpassword'
{code}
Конфиг необходимо разместить в папке с хуками /usr/local/Reductor/userinfo/hooks/nginx_reductor.conf:
{code}
# Configuration for Nginx
server {
listen 10.50.140.230:8080;
# Serve a static file (ex. favico) outside static dir.
location = /favico.ico {
root /app/favico.ico;
}
# Proxying connections to application servers
allow 10.50.140.222;
deny all;
location / {
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $remote_addr;
proxy_set_header Host $host;
proxy_pass http://127.0.0.1:8085;
}
}
{code}
Добавляем htpasswd:
{code}
# Configuration for Nginx
server {
listen 10.50.140.230:8080;
# Serve a static file (ex. favico) outside static dir.
location = /favico.ico {
root /app/favico.ico;
}
# Proxying connections to application servers
allow 10.50.140.222;
deny all;
location / {
auth_basic "Not Found 404"; # текст сообщения сервера с предложением ввести пароль
auth_basic_user_file /usr/local/Reductor/userinfo/hooks/nginx_htpasswd; # путь к htpasswd файлу
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $remote_addr;
proxy_set_header Host $host;
proxy_pass http://127.0.0.1:8085;
}
}
{code}
Создаём хук /usr/local/Reductor/userinfo/hooks/start.sh
{code}
#!/bin/bash
client_post_start_hook() {
echo "- Включаем basic auth в nginx"
cp -a $HOOKDIR/nginx_reductor.conf /etc/nginx/conf.d/
service nginx reload || service nginx restart || true
}
{code}
Делаем его исполняемым:
{code}
chmod a+x /usr/local/Reductor/userinfo/hooks/start.sh
{code}
Применяем всё что мы сделали:
{code}
service reductor restart
{code}