How do I enable ipv6 with Nginx
Hello,
EDIT: read that the flag is not there since 1.11.5 the flag was removed and should auto defect support for IPv6, I have listen [::]:80
in my conf file but going to the IPv6 address listed on my linodes page in cloud.linode.com it does not work I have allowed ports 80 in UFW and v6 is listed in the allowed.
I installed Nginx using
Installing Prebuilt Debian Packages
on my Debian 9 Linode
but it does not seem to have IPv6 support when doing Nginx -V this is the output everything I found on google says it should be enabled?.
Does anyone know what's going wrong and how I can enable IPv6 support?
nginx version: nginx/1.15.8
built by gcc 6.3.0 20170516 (Debian 6.3.0-18+deb9u1)
built with OpenSSL 1.1.0j 20 Nov 2018
TLS SNI support enabled
configure arguments: --prefix=/etc/nginx --sbin-path=/usr/sbin/nginx --modules-path=/usr/lib/nginx/modules --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-compat --with-file-aio --with-threads --with-http_addition_module --with-http_auth_request_module --with-http_dav_module --with-http_flv_module --with-http_gunzip_module --with-http_gzip_static_module --with-http_mp4_module --with-http_random_index_module --with-http_realip_module --with-http_secure_link_module --with-http_slice_module --with-http_ssl_module --with-http_stub_status_module --with-http_sub_module --with-http_v2_module --with-mail --with-mail_ssl_module --with-stream --with-stream_realip_module --with-stream_ssl_module --with-stream_ssl_preread_module --with-cc-opt='-g -O2 -fdebug-prefix-map=/data/builder/debuild/nginx-1.15.8/debian/debuild-base/nginx-1.15.8=. -specs=/usr/share/dpkg/no-pie-compile.specs -fstack-protector-strong -Wformat -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -fPIC' --with-ld-opt='-specs=/usr/share/dpkg/no-pie-link.specs -Wl,-z,relro -Wl,-z,now -Wl,--as-needed -pie'
1 Reply
FWIW, my nginx -V (installed from packages not built from source) doesn't say anything IPv6 either:
root@kman:~# nginx -V
nginx version: nginx/1.14.2
built with OpenSSL 1.1.1a 20 Nov 2018
TLS SNI support enabled
configure arguments: --with-cc-opt='-g -O2 -fdebug-prefix-map=/build/nginx-sWHVb6/nginx-1.14.2=. -fstack-protector-strong -Wformat -Werror=format-security -fPIC -Wdate-time -D_FORTIFY_SOURCE=2' --with-ld-opt='-Wl,-z,relro -Wl,-z,now -fPIC' --prefix=/usr/share/nginx --conf-path=/etc/nginx/nginx.conf --http-log-path=/var/log/nginx/access.log --error-log-path=/var/log/nginx/error.log --lock-path=/var/lock/nginx.lock --pid-path=/run/nginx.pid --modules-path=/usr/lib/nginx/modules --http-client-body-temp-path=/var/lib/nginx/body --http-fastcgi-temp-path=/var/lib/nginx/fastcgi --http-proxy-temp-path=/var/lib/nginx/proxy --http-scgi-temp-path=/var/lib/nginx/scgi --http-uwsgi-temp-path=/var/lib/nginx/uwsgi --with-debug --with-pcre-jit --with-http_ssl_module --with-http_stub_status_module --with-http_realip_module --with-http_auth_request_module --with-http_v2_module --with-http_dav_module --with-http_slice_module --with-threads --with-http_gzip_static_module --without-http_browser_module --without-http_geo_module --without-http_limit_req_module --without-http_limit_conn_module --without-http_memcached_module --without-http_referer_module --without-http_split_clients_module --without-http_userid_module --add-dynamic-module=/build/nginx-sWHVb6/nginx-1.14.2/debian/modules/http-echo
And yet, it does definitely listen on IPv6.
My server
listen 443 ssl http2;
listen [::]:443 ssl http2;
Suggestion:
Instead of troubleshooting by going to the IPv6 address - first check if nginx is listening on IPv6, this is as direct as can be:
netstat -tlnp
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN 22234/nginx: master
tcp 0 0 0.0.0.0:465 0.0.0.0:* LISTEN 22394/master
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 10466/sshd
tcp 0 0 0.0.0.0:25 0.0.0.0:* LISTEN 22394/master
tcp 0 0 0.0.0.0:443 0.0.0.0:* LISTEN 22234/nginx: master
tcp 0 0 127.0.0.1:8892 0.0.0.0:* LISTEN 728/opendkim
tcp 0 0 0.0.0.0:993 0.0.0.0:* LISTEN 22400/dovecot
tcp6 0 0 :::80 :::* LISTEN 22234/nginx: master
tcp6 0 0 :::465 :::* LISTEN 22394/master
tcp6 0 0 :::22 :::* LISTEN 10466/sshd
tcp6 0 0 :::25 :::* LISTEN 22394/master
tcp6 0 0 :::443 :::* LISTEN 22234/nginx: master
tcp6 0 0 :::993 :::* LISTEN 22400/dovecot
OR (newer tool)
ss -tlnp
State Recv-Q Send-Q Local Address:Port Peer Address:Port
LISTEN 0 128 0.0.0.0:80 0.0.0.0:* users:(("nginx",pid=22235,fd=6),("nginx",pid=22234,fd=6))
LISTEN 0 100 0.0.0.0:465 0.0.0.0:* users:(("master",pid=22394,fd=18))
LISTEN 0 128 0.0.0.0:22 0.0.0.0:* users:(("sshd",pid=10466,fd=3))
LISTEN 0 100 0.0.0.0:25 0.0.0.0:* users:(("master",pid=22394,fd=13))
LISTEN 0 128 0.0.0.0:443 0.0.0.0:* users:(("nginx",pid=22235,fd=8),("nginx",pid=22234,fd=8))
LISTEN 0 128 127.0.0.1:8892 0.0.0.0:* users:(("opendkim",pid=728,fd=3))
LISTEN 0 100 0.0.0.0:993 0.0.0.0:* users:(("dovecot",pid=22400,fd=33))
LISTEN 0 128 [::]:80 [::]:* users:(("nginx",pid=22235,fd=7),("nginx",pid=22234,fd=7))
LISTEN 0 100 [::]:465 [::]:* users:(("master",pid=22394,fd=19))
LISTEN 0 128 [::]:22 [::]:* users:(("sshd",pid=10466,fd=4))
LISTEN 0 100 [::]:25 [::]:* users:(("master",pid=22394,fd=14))
LISTEN 0 128 [::]:443 [::]:* users:(("nginx",pid=22235,fd=9),("nginx",pid=22234,fd=9))
LISTEN 0 100 [::]:993 [::]:* users:(("dovecot",pid=22400,fd=34))
As you can see, both report nginx listening on "all" address (0.0.0.0 for IPv6 and [::] for IPv6) on ports 80 and 443 (and there are some other services).