Welcome! Log In Create A New Profile

Advanced

Re: Nginx not spawning both ipv4 and ipv6 workers

July 26, 2016 04:39PM
This is Charles, moving over to the forum interface rather than email.

I realized I didn't include the server directive in my initial email, sorry about that. I'll include the entire set of configuration below.

I feel like I've been through all the configurations that I've seen during research and from recommendations from others.

I'm consistently seeing all nginx workers either being setup for ipv4 or ipv6, depending on the config changes. I'm also testing the connection from another server with ipv4/v6 connectivity, so I am able to verify that when the workers are set as ipv4 only ipv4 connections work, and when ipv6 is set on the workers only ipv6 connections work.

Version:
> nginx -v
> nginx version: nginx/1.10.0 (Ubuntu)

"bindv6only" is off.
> sysctl net.ipv6.bindv6only
> net.ipv6.bindv6only = 0

The configuration tests as ok.
> sudo nginx -t -c /etc/nginx/nginx.conf
> nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
> nginx: configuration file /etc/nginx/nginx.conf test is successful

Here's my simplified config (sites-enabled is disabled):

> # /etc/nginx/nginx.conf
> user www-data;
> worker_rlimit_nofile 30000;
> worker_processes 8;
> pid /run/nginx.pid;
>
> events {
> worker_connections 500000;
> }
>
> http {
> sendfile on;
> tcp_nopush on;
> tcp_nodelay on;
> keepalive_timeout 65;
> types_hash_max_size 2048;
>
> include /etc/nginx/mime.types;
> default_type application/octet-stream;
>
> access_log /var/log/nginx/access.log;
> error_log /var/log/nginx/error.log;
>
> gzip on;
> gzip_disable "msie6";
> gzip_vary on;
> gzip_proxied any;
> gzip_comp_level 6;
> gzip_buffers 16 8k;
> gzip_http_version 1.1;
> gzip_types text/plain text/css application/json application/javascript text/xml application/xml application/xml+rss text/javascript;
>
> include /etc/nginx/conf.d/*.conf;
> # include /etc/nginx/sites-enabled/*;
>
> # /etc/nginx/sites-enabled/blog
> server {
> server_name test.bloggyblog.com
>
> listen 80;
> listen [::]:80;
>
> root /usr/local/apps/blog;
> index index.php;
>
> location / {
> try_files $uri $uri/ =404;
> }
>
> location ~ \.php$ {
> try_files $uri =404;
> fastcgi_split_path_info ^(.+\.php)(/.+)$;
> fastcgi_pass unix:/var/run/php/php7.0-fpm.sock;
> fastcgi_index index.php;
> fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
> include fastcgi_params;
> }
> }
> }

These are the results of difference configurations:
listen 80;
listen [::]:80;
> sudo lsof -i
> nginx 1327 www-data 6u IPv6 275594 0t0 TCP *:http (LISTEN)
> nginx 1328 www-data 6u IPv6 275594 0t0 TCP *:http (LISTEN)
> nginx 1329 www-data 6u IPv6 275594 0t0 TCP *:http (LISTEN)
> nginx 1330 www-data 6u IPv6 275594 0t0 TCP *:http (LISTEN)
> nginx 1331 www-data 6u IPv6 275594 0t0 TCP *:http (LISTEN)
> nginx 1332 www-data 6u IPv6 275594 0t0 TCP *:http (LISTEN)
> nginx 1333 www-data 6u IPv6 275594 0t0 TCP *:http (LISTEN)
> nginx 1334 www-data 6u IPv6 275594 0t0 TCP *:http (LISTEN)

listen [::]:80 ipv6only=off;
> nginx 1492 root 6u IPv4 278341 0t0 TCP *:http (LISTEN)
> nginx 1493 www-data 6u IPv4 278341 0t0 TCP *:http (LISTEN)
> nginx 1494 www-data 6u IPv4 278341 0t0 TCP *:http (LISTEN)
> nginx 1495 www-data 6u IPv4 278341 0t0 TCP *:http (LISTEN)
> nginx 1496 www-data 6u IPv4 278341 0t0 TCP *:http (LISTEN)
> nginx 1497 www-data 6u IPv4 278341 0t0 TCP *:http (LISTEN)
> nginx 1498 www-data 6u IPv4 278341 0t0 TCP *:http (LISTEN)
> nginx 1499 www-data 6u IPv4 278341 0t0 TCP *:http (LISTEN)
> nginx 1500 www-data 6u IPv4 278341 0t0 TCP *:http (LISTEN)
Subject Author Posted

Nginx not spawning both ipv4 and ipv6 workers

Charles Lawrence July 25, 2016 08:26PM

Re: Nginx not spawning both ipv4 and ipv6 workers

FinalX July 26, 2016 04:48AM

Re: Nginx not spawning both ipv4 and ipv6 workers

geuis July 26, 2016 04:47PM

Re: Nginx not spawning both ipv4 and ipv6 workers

geuis July 26, 2016 07:10PM

Re: Nginx not spawning both ipv4 and ipv6 workers

Maxim Dounin July 26, 2016 12:44PM

Re: Nginx not spawning both ipv4 and ipv6 workers

geuis July 26, 2016 04:39PM

Re: Nginx not spawning both ipv4 and ipv6 workers

geuis July 26, 2016 05:18PM

Re: Nginx not spawning both ipv4 and ipv6 workers

geuis July 26, 2016 07:10PM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 313
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready