Using IPv6 with Nginx


Here is the example of Using IPv6 with Nginx in Centos and Centmin Mod

Step 1: Go to folder: /usr/local/nginx/conf/conf.d
We can find file tutorialspots.com.conf

nginx conf

Step 2: add line

	listen   [2001:41d0:a:3171:0:1041:2729:a652]:80;
# Centmin Mod Getting Started Guide
# must read http://centminmod.com/getstarted.html

# redirect from non-www to www 
# uncomment, save file and restart Nginx to enable
# if unsure use return 302 before using return 301
#server {
#            listen   80;
#            server_name tutorialspots.com;
#            return 301 $scheme://www.tutorialspots.com$request_uri;
#       }

server {
	listen   [2001:41d0:a:3171:0:1041:2729:a652]:80;
  server_name tutorialspots.com www.tutorialspots.com;

# ngx_pagespeed & ngx_pagespeed handler
#include /usr/local/nginx/conf/pagespeed.conf;
#include /usr/local/nginx/conf/pagespeedhandler.conf;
#include /usr/local/nginx/conf/pagespeedstatslog.conf;

  # limit_conn limit_per_ip 16;
  # ssi  on;

  access_log /home/nginx/domains/tutorialspots.com/log/access.log combined buffer=256k flush=60m;
  error_log /home/nginx/domains/tutorialspots.com/log/error.log;

  root /home/nginx/domains/tutorialspots.com/public;

  location / {

# block common exploits, sql injections etc
#include /usr/local/nginx/conf/block.conf;

  # Enables directory listings when index file not found
  #autoindex  on;

  # Shows file listing times as local time
  #autoindex_localtime on;

  # Enable for vBulletin usage WITHOUT vbSEO installed
  # More example Nginx vhost configurations at
  # http://centminmod.com/nginx_configure.html
  #try_files    $uri $uri/ /index.php;

  }

  include /usr/local/nginx/conf/staticfiles.conf;
  include /usr/local/nginx/conf/php.conf;
  include /usr/local/nginx/conf/drop.conf;
  #include /usr/local/nginx/conf/errorpage.conf;
  include /usr/local/nginx/conf/vts_server.conf;
}

Step 3: restart nginx

service nginx restart

With your domain, you can use CloudFlare to use IPV6

Leave a Reply