Nginx not spawning both ipv4 and ipv6 workers
geuis
nginx-forum at forum.nginx.org
Tue Jul 26 20:39:22 UTC 2016
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)
Posted at Nginx Forum: https://forum.nginx.org/read.php?2,268460,268519#msg-268519
More information about the nginx
mailing list