Nginx использует IPv6 в proxy pass, даже если он отключен
Добрый день, На сервере отключен IPv6. На nginx настроено проксирование на upstream c поддержкой IPv4 и IPv6. Nginx периодически (раз в 5 секунд) пытается отправлять запросы на IPv6 и соответственно обламывается с ошибками: 2013/07/30 00:25:06 [error] 1930#0: *1482670 connect() to [::C:DDD:E:F:GGG:HHH]:443 failed (101: Network is unreachable) while connecting to upstream, client: AA.BB.CC.DD, server: example.com, request: GET /download/file HTTP/1.0, upstream: https://[::C:DDD:E:F:GGG:HHH]:443/download/file;, host: example.com Как можно отключить IPv6 для proxy_pass? # nginx.conf: upstream download { server download.example.com:443; keepalive 8; } location /download { proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header Connection ; proxy_ignore_headers X-Accel-Redirect; proxy_http_version1.1; resolver 8.8.8.8; resolver_timeout 5s; proxy_passhttps://download; } nginx -V: nginx version: nginx/1.4.2 built by gcc 4.7.2 (Debian 4.7.2-5) TLS SNI support enabled configure arguments: --prefix=/etc/nginx --sbin-path=/usr/sbin/nginx --conf-path=/etc/nginx/nginx.conf --error-log-path=/var/log/nginx/error.log --http-log-path=/var/log/nginx/access.log --pid-path=/var/run/nginx.pid --lock-path=/var/run/nginx.lock --http-client-body-temp-path=/var/cache/nginx/client_temp --http-proxy-temp-path=/var/cache/nginx/proxy_temp --http-fastcgi-temp-path=/var/cache/nginx/fastcgi_temp --http-uwsgi-temp-path=/var/cache/nginx/uwsgi_temp --http-scgi-temp-path=/var/cache/nginx/scgi_temp --user=nginx --group=nginx --with-http_ssl_module --with-http_realip_module --with-http_addition_module --with-http_sub_module --with-http_dav_module --with-http_flv_module --with-http_mp4_module --with-http_gunzip_module --with-http_gzip_static_module --with-http_random_index_module --with-http_secure_link_module --with-http_stub_status_module --with-mail --with-mail_ssl_module --with-file-aio --with-http_spdy_module --with-cc-opt='-g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2' --with-ld-opt=-Wl,-z,relro --with-ipv6 uname -a: Linux 3.2.0-4-amd64 #1 SMP Debian 3.2.46-1 x86_64 GNU/Linux Posted at Nginx Forum: http://forum.nginx.org/read.php?21,241403,241403#msg-241403 ___ nginx-ru mailing list nginx-ru@nginx.org http://mailman.nginx.org/mailman/listinfo/nginx-ru
Re: Nginx использует IPv6 в proxy pass, даже если он отключен
On Wed, Jul 31, 2013 at 04:06:27AM -0400, Antohat wrote: Добрый день, На сервере отключен IPv6. На nginx настроено проксирование на upstream c поддержкой IPv4 и IPv6. Nginx периодически (раз в 5 секунд) пытается отправлять запросы на IPv6 и соответственно обламывается с ошибками: 2013/07/30 00:25:06 [error] 1930#0: *1482670 connect() to [::C:DDD:E:F:GGG:HHH]:443 failed (101: Network is unreachable) while connecting to upstream, client: AA.BB.CC.DD, server: example.com, request: GET /download/file HTTP/1.0, upstream: https://[::C:DDD:E:F:GGG:HHH]:443/download/file;, host: example.com Как можно отключить IPv6 для proxy_pass? Как-то заставить системный resolver(3) не возвращать IPv6-адреса (ответы типа ) для хоста, на котором отключен IPv6. Попробуйте добиться желаемого эффекта с командой telnet download.example.com Или же использовать IPv4-адреса в конфигурации nginx. Кстати, в приведенной конфигурации директива resolver не нужна. # nginx.conf: upstream download { server download.example.com:443; keepalive 8; } location /download { proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header Connection ; proxy_ignore_headers X-Accel-Redirect; proxy_http_version1.1; resolver 8.8.8.8; resolver_timeout 5s; proxy_passhttps://download; } nginx -V: nginx version: nginx/1.4.2 built by gcc 4.7.2 (Debian 4.7.2-5) TLS SNI support enabled configure arguments: --prefix=/etc/nginx --sbin-path=/usr/sbin/nginx --conf-path=/etc/nginx/nginx.conf --error-log-path=/var/log/nginx/error.log --http-log-path=/var/log/nginx/access.log --pid-path=/var/run/nginx.pid --lock-path=/var/run/nginx.lock --http-client-body-temp-path=/var/cache/nginx/client_temp --http-proxy-temp-path=/var/cache/nginx/proxy_temp --http-fastcgi-temp-path=/var/cache/nginx/fastcgi_temp --http-uwsgi-temp-path=/var/cache/nginx/uwsgi_temp --http-scgi-temp-path=/var/cache/nginx/scgi_temp --user=nginx --group=nginx --with-http_ssl_module --with-http_realip_module --with-http_addition_module --with-http_sub_module --with-http_dav_module --with-http_flv_module --with-http_mp4_module --with-http_gunzip_module --with-http_gzip_static_module --with-http_random_index_module --with-http_secure_link_module --with-http_stub_status_module --with-mail --with-mail_ssl_module --with-file-aio --with-http_spdy_module --with-cc-opt='-g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2' --with-ld-opt=-Wl,-z,relro --with-ipv6 uname -a: Linux 3.2.0-4-amd64 #1 SMP Debian 3.2.46-1 x86_64 GNU/Linux Posted at Nginx Forum: http://forum.nginx.org/read.php?21,241403,241403#msg-241403 ___ nginx-ru mailing list nginx-ru@nginx.org http://mailman.nginx.org/mailman/listinfo/nginx-ru
Re: Nginx использует IPv6 в proxy pass, даже если он отключен
31.07.2013 14:06, Antohat пишет: Добрый день, На сервере отключен IPv6. На nginx настроено проксирование на upstream c поддержкой IPv4 и IPv6. Nginx периодически (раз в 5 секунд) пытается отправлять запросы на IPv6 и соответственно обламывается с ошибками: 2013/07/30 00:25:06 [error] 1930#0: *1482670 connect() to [::C:DDD:E:F:GGG:HHH]:443 failed (101: Network is unreachable) while connecting to upstream, client: AA.BB.CC.DD, server: example.com, request: GET /download/file HTTP/1.0, upstream: https://[::C:DDD:E:F:GGG:HHH]:443/download/file;, host: example.com Как можно отключить IPv6 для proxy_pass? # nginx.conf: upstream download { server download.example.com:443; keepalive 8; } location /download { proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header Connection ; proxy_ignore_headers X-Accel-Redirect; proxy_http_version1.1; resolver 8.8.8.8; resolver_timeout 5s; proxy_passhttps://download; } nginx -V: nginx version: nginx/1.4.2 built by gcc 4.7.2 (Debian 4.7.2-5) TLS SNI support enabled configure arguments: --prefix=/etc/nginx --sbin-path=/usr/sbin/nginx --conf-path=/etc/nginx/nginx.conf --error-log-path=/var/log/nginx/error.log --http-log-path=/var/log/nginx/access.log --pid-path=/var/run/nginx.pid --lock-path=/var/run/nginx.lock --http-client-body-temp-path=/var/cache/nginx/client_temp --http-proxy-temp-path=/var/cache/nginx/proxy_temp --http-fastcgi-temp-path=/var/cache/nginx/fastcgi_temp --http-uwsgi-temp-path=/var/cache/nginx/uwsgi_temp --http-scgi-temp-path=/var/cache/nginx/scgi_temp --user=nginx --group=nginx --with-http_ssl_module --with-http_realip_module --with-http_addition_module --with-http_sub_module --with-http_dav_module --with-http_flv_module --with-http_mp4_module --with-http_gunzip_module --with-http_gzip_static_module --with-http_random_index_module --with-http_secure_link_module --with-http_stub_status_module --with-mail --with-mail_ssl_module --with-file-aio --with-http_spdy_module --with-cc-opt='-g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2' --with-ld-opt=-Wl,-z,relro --with-ipv6 uname -a: Linux 3.2.0-4-amd64 #1 SMP Debian 3.2.46-1 x86_64 GNU/Linux Posted at Nginx Forum: http://forum.nginx.org/read.php?21,241403,241403#msg-241403 ___ nginx-ru mailing list nginx-ru@nginx.org http://mailman.nginx.org/mailman/listinfo/nginx-ru Вы используете ipv6? Если нет - попробуйте отключить его в системе. Выполните: sysctl -w net.ipv6.conf.all.disable_ipv6=1 sysctl -w net.ipv6.conf.default.disable_ipv6=1 sysctl -w net.ipv6.conf.lo.disable_ipv6=1 и перезапустив nginx попробуйте воспроизвести ошибку. Если ошибка не воспроизведется - добавьте в /etc/sysctl.conf это: net.ipv6.conf.all.disable_ipv6 = 1 net.ipv6.conf.default.disable_ipv6 = 1 net.ipv6.conf.lo.disable_ipv6 = 1 ___ nginx-ru mailing list nginx-ru@nginx.org http://mailman.nginx.org/mailman/listinfo/nginx-ru
Re: Nginx использует IPv6 в proxy pass, даже если он отключен
Ruslan Ermilov Wrote: --- Как-то заставить системный resolver(3) не возвращать IPv6-адреса (ответы типа ) для хоста, на котором отключен IPv6. Попробуйте добиться желаемого эффекта с командой telnet download.example.com Не уверен, что так можно сделать... Может быть было бы правильнее, чтобы nginx определял, что IPv6 не настроен и не пытался использовать записи ? По крайней мере такой параметр в конфиге точно не был бы лишним. Или же использовать IPv4-адреса в конфигурации nginx. Кстати, в приведенной конфигурации директива resolver не нужна. К сожалению не можем, т.к. IP апстрима могут меняться без предварительного уведомления. Posted at Nginx Forum: http://forum.nginx.org/read.php?21,241405,241407#msg-241407 ___ nginx-ru mailing list nginx-ru@nginx.org http://mailman.nginx.org/mailman/listinfo/nginx-ru
Re: Nginx использует IPv6 в proxy pass, даже если он отключен
Raven_kg Wrote: --- Вы используете ipv6? Если нет - попробуйте отключить его в системе. Выполните: sysctl -w net.ipv6.conf.all.disable_ipv6=1 sysctl -w net.ipv6.conf.default.disable_ipv6=1 sysctl -w net.ipv6.conf.lo.disable_ipv6=1 и перезапустив nginx попробуйте воспроизвести ошибку. Если ошибка не воспроизведется - добавьте в /etc/sysctl.conf это: net.ipv6.conf.all.disable_ipv6 = 1 net.ipv6.conf.default.disable_ipv6 = 1 net.ipv6.conf.lo.disable_ipv6 = 1 У нас уже была установлена опция net.ipv6.conf.all.disable_ipv6=1 Добавление net.ipv6.conf.default.disable_ipv6=1 и net.ipv6.conf.lo.disable_ipv6=1 не помогает. Posted at Nginx Forum: http://forum.nginx.org/read.php?21,241406,241408#msg-241408 ___ nginx-ru mailing list nginx-ru@nginx.org http://mailman.nginx.org/mailman/listinfo/nginx-ru
Re: Nginx использует IPv6 в proxy pass, даже если он отключен
On Wed, Jul 31, 2013 at 06:10:55AM -0400, Antohat wrote: Ruslan Ermilov Wrote: --- Как-то заставить системный resolver(3) не возвращать IPv6-адреса (ответы типа ) для хоста, на котором отключен IPv6. Попробуйте добиться желаемого эффекта с командой telnet download.example.com Не уверен, что так можно сделать... Может быть было бы правильнее, чтобы nginx определял, что IPv6 не настроен и не пытался использовать записи ? Что ж бедному nginx, на каждый чих это проверять? Ведь сейчас может быть не настроен, а через минуту уже настроен. По крайней мере такой параметр в конфиге точно не был бы лишним. А ещё хорошо иметь настройку в nginx.conf, которая проверяет, что утюг дома не забыли выключить. :) Или же использовать IPv4-адреса в конфигурации nginx. Кстати, в приведенной конфигурации директива resolver не нужна. К сожалению не можем, т.к. IP апстрима могут меняться без предварительного уведомления. Ну соберите nginx без --with-ipv6, и будет вам счастье. ___ nginx-ru mailing list nginx-ru@nginx.org http://mailman.nginx.org/mailman/listinfo/nginx-ru
Re: Nginx использует IPv6 в proxy pass, даже если он отключен
топикстартеру: если резолвер под вашим управлением, то, возможно, поможет следующее обсуждение: http://comments.gmane.org/gmane.network.dns.operations/1538 -- boco ___ nginx-ru mailing list nginx-ru@nginx.org http://mailman.nginx.org/mailman/listinfo/nginx-ru
Re: Nginx использует IPv6 в proxy pass, даже если он отключен
31.07.2013 16:10, Antohat пишет: Ruslan Ermilov Wrote: --- Как-то заставить системный resolver(3) не возвращать IPv6-адреса (ответы типа ) для хоста, на котором отключен IPv6. Попробуйте добиться желаемого эффекта с командой telnet download.example.com Не уверен, что так можно сделать... Может быть было бы правильнее, чтобы nginx определял, что IPv6 не настроен и не пытался использовать записи ? По крайней мере такой параметр в конфиге точно не был бы лишним. Или же использовать IPv4-адреса в конфигурации nginx. Кстати, в приведенной конфигурации директива resolver не нужна. К сожалению не можем, т.к. IP апстрима могут меняться без предварительного уведомления. Posted at Nginx Forum: http://forum.nginx.org/read.php?21,241405,241407#msg-241407 ___ nginx-ru mailing list nginx-ru@nginx.org http://mailman.nginx.org/mailman/listinfo/nginx-ru Заюзайте резольвер не поддерживающий . ___ nginx-ru mailing list nginx-ru@nginx.org http://mailman.nginx.org/mailman/listinfo/nginx-ru
Nginx and logrotate
Linux 3.8.13-gentoo x86_64 nginx-1.4.1-r2 logrotate-3.8.4 cat /etc/logrotate.d/nginx: /var/log/nginx/*.log { daily rotate 5 missingok nocompress sharedscripts postrotate test -r /run/nginx.pid kill -USR1 `cat /run/nginx.pid` endscript } /etc/logrotate.conf: weekly rotate 4 create dateext compress notifempty nomail noolddir include /etc/logrotate.d /var/log/wtmp { monthly create 0664 root utmp minsize 1M rotate 1 } /var/log/btmp { missingok monthly create 0600 root utmp rotate 1 } # ls -alh /var/log/nginx/ | grep access.log -rw-r--r-- 1 nginx root0 Jul 30 03:10 access.log -rw-r--r-- 1 nginx root 4.7G Jul 18 10:09 access.log-20130712 -rw-r--r-- 1 nginx root 7.6G Jul 29 09:46 access.log-20130719 -rw-r--r-- 1 nginx root 1.4G Jul 31 22:04 access.log-20130730 Т.е. запись в access.log не идет, а растет access.log-20130730. kill -USR1 `cat /run/nginx.pid` ситуацию не меняет. Что я не так? Спасибо. ___ nginx-ru mailing list nginx-ru@nginx.org http://mailman.nginx.org/mailman/listinfo/nginx-ru
Re: Обработка error page 405
Find a suitable for your stuff will have a sense of accomplishment that can come efox look, there may be something you want Posted at Nginx Forum: http://forum.nginx.org/read.php?21,241125,241431#msg-241431 ___ nginx-ru mailing list nginx-ru@nginx.org http://mailman.nginx.org/mailman/listinfo/nginx-ru
Re: Nginx and logrotate
01.08.2013 03:07, Sergey Kobzar пишет: Linux 3.8.13-gentoo x86_64 nginx-1.4.1-r2 logrotate-3.8.4 cat /etc/logrotate.d/nginx: /var/log/nginx/*.log { daily rotate 5 missingok nocompress sharedscripts postrotate test -r /run/nginx.pid kill -USR1 `cat /run/nginx.pid` endscript } /etc/logrotate.conf: weekly rotate 4 create dateext compress notifempty nomail noolddir include /etc/logrotate.d /var/log/wtmp { monthly create 0664 root utmp minsize 1M rotate 1 } /var/log/btmp { missingok monthly create 0600 root utmp rotate 1 } # ls -alh /var/log/nginx/ | grep access.log -rw-r--r-- 1 nginx root0 Jul 30 03:10 access.log -rw-r--r-- 1 nginx root 4.7G Jul 18 10:09 access.log-20130712 -rw-r--r-- 1 nginx root 7.6G Jul 29 09:46 access.log-20130719 -rw-r--r-- 1 nginx root 1.4G Jul 31 22:04 access.log-20130730 Т.е. запись в access.log не идет, а растет access.log-20130730. kill -USR1 `cat /run/nginx.pid` ситуацию не меняет. Что я не так? Спасибо. ___ nginx-ru mailing list nginx-ru@nginx.org http://mailman.nginx.org/mailman/listinfo/nginx-ru У меня (RHEL 6) в качестве postrotate-команды используется эта: /etc/init.d/nginx reload /dev/null 2/dev/null || true в скрипте /etc/init.d/nginx в функции отвечающей за reload используется killproc $nginx -HUP Попробуйте сменить -USR1 в вашей команде на -HUP? Вот так это выглядит целиком: /var/log/nginx/*log { missingok compress notifempty sharedscripts postrotate /sbin/service nginx reload /dev/null 2/dev/null || true endscript } ___ nginx-ru mailing list nginx-ru@nginx.org http://mailman.nginx.org/mailman/listinfo/nginx-ru