Nginx заглушка

Делаем два редиректа, с 443 на 80 никто перейти не даст, а с 80 на 443 нам не нужно.
Как работает: 80-е и 443-е запросы идут по своим правилам отдельно.
Запросы с адресами после слэша заворачиваются на ту же страницу 
посредством error_page.

nano /etc/nginx/conf.d/00_stat_zaglushka_vhost.conf
server {
listen *:443;
server_name IPSERVER;
ssl on;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_ciphers HIGH:!aNULL:!MD5;
ssl_prefer_server_ciphers on;
ssl_certificate /etc/nginx/conf.d/ssl/ca.crt;
ssl_certificate_key /etc/nginx/conf.d/ssl/ca.key;
charset koi8-r;
location / {
root /var/www/mikbill/stat/res/nomoney;
index index.html;
}
error_page 400 401 403 404 500 501 502 503 504 /index.html;
location = /index.html {
root /var/www/mikbill/stat/res/nomoney;
}
}
server {
listen *:80;
server_name IPSERVER;
charset koi8-r;
location / {
root /var/www/mikbill/stat/res/nomoney;
index index.html;
}
error_page 400 401 403 404 500 501 502 503 504 /index.html;
location = /index.html {
root /var/www/mikbill/stat/res/nomoney;
}
}

Правила для микротика:
add action=dst-nat chain=dstnat comment="Redirect to nomoney 443" dst-port=443 \
protocol=tcp src-address=10.10.10.0/24 to-addresses=192.168.10.10 to-ports=\
443 
add action=dst-nat chain=dstnat comment="Redirect to nomoney 80" dst-port=80 \
protocol=tcp src-address=10.10.10.0/24 to-addresses=192.168.10.10 to-ports=\
80


Комментарии

Популярные сообщения из этого блога

mikbill расшифровка завершений сессий

Accel-ppp команды

Zabbix agent установка и настройка