Page 1 of 2

VESTACP и Cloudflare настройка

Posted: Mon Nov 14, 2016 8:58 pm
by ars
Я пользуюсь и в логах не вижу реальные адреса посетителей
Знаю, на форуме не раз поднимались разные проблемы с Cloudflare, но не нашел корректного руководства по настройке nginx для VestaCP, чтоб корректно отображалось IP адреса

Re: VESTACP и Cloudflare настройка

Posted: Tue Nov 15, 2016 2:51 pm
by ars
any help ?

Re: VESTACP и Cloudflare настройка

Posted: Tue Nov 15, 2016 6:48 pm
by http
если не ошибаюсь это можно в cloudflare настроить

Re: VESTACP и Cloudflare настройка

Posted: Tue Nov 15, 2016 7:00 pm
by ars
По моему на сервере нужно, чтоб потом для каждого домена не делать

Re: VESTACP и Cloudflare настройка

Posted: Tue Nov 15, 2016 8:27 pm
by Stesh
В основной конфиг nginx, до инклудов других файлов (т.е. перед # Wildcard include) добавить

Code: Select all

set_real_ip_from 103.21.244.0/22;
set_real_ip_from 103.22.200.0/22;
set_real_ip_from 103.31.4.0/22;
set_real_ip_from 104.16.0.0/12;
set_real_ip_from 108.162.192.0/18;
set_real_ip_from 131.0.72.0/22;
set_real_ip_from 141.101.64.0/18;
set_real_ip_from 162.158.0.0/15;
set_real_ip_from 172.64.0.0/13;
set_real_ip_from 173.245.48.0/20;
set_real_ip_from 188.114.96.0/20;
set_real_ip_from 190.93.240.0/20;
set_real_ip_from 197.234.240.0/22;
set_real_ip_from 198.41.128.0/17;
set_real_ip_from 199.27.128.0/21;
set_real_ip_from 2400:cb00::/32;
set_real_ip_from 2606:4700::/32;
set_real_ip_from 2803:f800::/32;
set_real_ip_from 2405:b500::/32;
set_real_ip_from 2405:8100::/32;
set_real_ip_from 2c0f:f248::/32;
set_real_ip_from 2a06:98c0::/29;

# use any of the following two
real_ip_header CF-Connecting-IP;
#real_ip_header X-Forwarded-For;
ip уточнить здесь https://www.cloudflare.com/ips/

Затем nginx -t (проверяем конфиг). Если все ок, то service nginx restart

Re: VESTACP и Cloudflare настройка

Posted: Tue Nov 15, 2016 8:32 pm
by ars
Спасибо!
То есть других нгниксовских модулей не надо подгружать :)

Re: VESTACP и Cloudflare настройка

Posted: Tue Nov 15, 2016 8:54 pm
by ars
Не берет :(

# nginx -t
nginx: [emerg] invalid number of arguments in "set_real_ip_from" directive in /etc/nginx/nginx.conf:125
nginx: configuration file /etc/nginx/nginx.conf test failed

Re: VESTACP и Cloudflare настройка

Posted: Tue Nov 15, 2016 10:03 pm
by Stesh
ars wrote:Не берет :(

# nginx -t
nginx: [emerg] invalid number of arguments in "set_real_ip_from" directive in /etc/nginx/nginx.conf:125
nginx: configuration file /etc/nginx/nginx.conf test failed
Что в строках 123-127?

Re: VESTACP и Cloudflare настройка

Posted: Tue Nov 15, 2016 11:03 pm
by ars
Ничего:



set_real_ip_from 103.21.244.0/22
set_real_ip_from 103.22.200.0/22
set_real_ip_from 103.31.4.0/22
set_real_ip_from 104.16.0.0/12
set_real_ip_from 108.162.192.0/18
set_real_ip_from 131.0.72.0/22
set_real_ip_from 141.101.64.0/18
set_real_ip_from 162.158.0.0/15
set_real_ip_from 172.64.0.0/13
set_real_ip_from 173.245.48.0/20
set_real_ip_from 188.114.96.0/20
set_real_ip_from 190.93.240.0/20
set_real_ip_from 197.234.240.0/22
set_real_ip_from 198.41.128.0/17
set_real_ip_from 199.27.128.0/21
set_real_ip_from 2400:cb00::/32
set_real_ip_from 2405:8100::/32
set_real_ip_from 2405:b500::/32
set_real_ip_from 2606:4700::/32
set_real_ip_from 2803:f800::/32
set_real_ip_from 2c0f:f248::/32
set_real_ip_from 2a06:98c0::/29
123
# use any of the following two
real_ip_header CF-Connecting-IP;
#real_ip_header X-Forwarded-For;
127

Re: VESTACP и Cloudflare настройка

Posted: Tue Nov 15, 2016 11:09 pm
by ars
Нашел , не хватали ";" :)
Спасибо !