Centmin Mod: enable IPv6 with Nginx


To check if your Nginx server support Ipv6, you can use this command:

nginx -V

Here the example with the server that support Ipv6

[root@tutorialspots ~]# nginx -V
nginx version: nginx/1.9.6
built by clang 3.4.2 (tags/RELEASE_34/dot2-final)
built with LibreSSL 2.2.4
TLS SNI support enabled
configure arguments: --with-ld-opt='-lrt -ljemalloc -Wl,-z,relro -Wl,-rpath,/usr
/local/lib' --with-cc-opt='-m32 -mtune=generic -g -O2 -fstack-protector --param=
ssp-buffer-size=4 -Wformat -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wno-
deprecated-declarations -Wno-unused-parameter -Wno-unused-const-variable -Wno-co
nditional-uninitialized -Wno-mismatched-tags -Wno-c++11-extensions -Wno-sometime
s-uninitialized -Wno-parentheses-equality -Wno-tautological-compare -Wno-self-as
sign -Wno-deprecated-register -Wno-deprecated -Wno-invalid-source-encoding -Wno-
pointer-sign -Wno-parentheses -Wno-enum-conversion' --sbin-path=/usr/local/sbin/
nginx --conf-path=/usr/local/nginx/conf/nginx.conf --with-ipv6 --with-http_ssl_m
odule --with-http_v2_module --with-http_gzip_static_module --with-http_stub_stat
us_module --with-http_sub_module --with-http_addition_module --with-http_image_f
ilter_module --with-http_secure_link_module --with-http_realip_module --with-htt
p_geoip_module --with-openssl-opt=enable-tlsext --add-module=../ngx-fancyindex-n
gx-fancyindex --add-module=../ngx_cache_purge-2.3 --add-module=../nginx-accesske
y-2.0.3 --add-module=../nginx-http-concat-master --add-module=../openresty-memc-
nginx-module-4f6f78f --add-module=../openresty-srcache-nginx-module-ffa9ab7 --ad
d-module=../ngx_devel_kit-0.2.19 --add-module=../set-misc-nginx-module-0.29 --ad
d-module=../echo-nginx-module-0.58 --add-module=../redis2-nginx-module-0.12 --ad
d-module=../ngx_http_redis-0.3.7 --add-module=../lua-nginx-module-0.9.16 --add-m
odule=../lua-upstream-nginx-module-0.03 --add-module=../lua-upstream-cache-nginx
-module-0.1.1 --add-module=../nginx_upstream_check_module-0.3.0 --add-module=../
nginx-module-vts --add-module=../headers-more-nginx-module-0.261 --with-openssl=
../libressl-2.2.4 --with-libatomic --with-threads --with-stream --with-stream_ss
l_module --with-pcre=../pcre-8.37 --with-pcre-jit --add-module=../ngx_pagespeed-
1.9.32.10-beta

you see –with-ipv6.

If your nginx server doesn’t support ipv6, you won’t see it, and you will get this error:

 [root@tutorialspots ~]# service nginx restart
nginx: [emerg] the INET6 sockets are not supported on this platform in "[2001:19
f0:6000:9bee:5400:00ff:fe1e:08eb]:80" of the "listen" directive in /usr/local/ng
inx/conf/conf.d/tutorialspots.com.conf:14
nginx: configuration file /usr/local/nginx/conf/nginx.conf test failed

How to fix it?
You must recompile Nginx on your server.

Step 1: Open file /usr/local/src/centminmod/centmin.sh

You must place this line:

NGINX_IPV='y'

centmin sh

then verify in this file have these lines:

# General Configuration
NGINXUPGRADESLEEP='6'
NSD_INSTALL=y                # Install NSD (DNS Server)
NSD_VERSION='3.2.18'         # NSD Version
NTP_INSTALL=y                # Install Network time protocol daemon
NGINXPATCH=y                 # Set to y to allow NGINXPATCH_DELAY seconds time before Nginx configure and patching Nginx
NGINXPATCH_DELAY='1'         # Number of seconds to pause Nginx configure routine during Nginx upgrades
STRIPNGINX='y'               # set 'y' to strip nginx binary to reduce size
NGINX_INSTALL=y              # Install Nginx (Webserver)
NGINX_DEBUG=n                # Enable & reinstall Nginx debug log nginx.org/en/docs/debugging_log.html & wiki.nginx.org/Debugging
NGINX_HTTP2=y                # Nginx http/2 patch https://community.centminmod.com/threads/4127/
NGINX_GEOIP=y                # Nginx GEOIP module install
NGINX_SPDY=n                 # Nginx SPDY support
NGINX_STREAM=y               # http://nginx.org/en/docs/stream/ngx_stream_core_module.html
NGINX_RTMP=n                 # Nginx RTMP Module support https://github.com/arut/nginx-rtmp-module
NGINX_FLV=n                  # http://nginx.org/en/docs/http/ngx_http_flv_module.html
NGINX_MP4=n                  # Nginx MP4 Module http://nginx.org/en/docs/http/ngx_http_mp4_module.html
NGINX_AUTHREQ=n              # http://nginx.org/en/docs/http/ngx_http_auth_request_module.html
NGINX_SECURELINK=y           # http://nginx.org/en/docs/http/ngx_http_secure_link_module.html
NGINX_FANCYINDEX=y           # http://wiki.nginx.org/NgxFancyIndex
NGINX_VHOSTSTATS=y           # https://github.com/vozlt/nginx-module-vts
NGINX_PAGESPEED=y            # Install ngx_pagespeed
NGINX_PAGESPEEDGITMASTER=n   # Install ngx_pagespeed from official github master instead  
NGXPGSPEED_VER='1.9.32.11-beta'
NGINX_PAGESPEEDPSOL_VER='1.9.32.11'
NGINX_PASSENGER='n'          # Install Phusion Passenger requires installing addons/passenger.sh before hand
NGINX_WEBDAV=n               # Nginx WebDAV and nginx-dav-ext-module
NGINX_EXTWEBDAVVER='0.0.3'   # nginx-dav-ext-module version
NGINX_LIBATOMIC=y            # Nginx configured with libatomic support
NGINX_HTTPREDIS=y            # Nginx redis http://wiki.nginx.org/HttpRedisModule
NGINX_HTTPREDISVER='0.3.7'   # Nginx redis version
NGINX_PCREJIT=y              # Nginx configured with pcre & pcre-jit support
NGINX_PCREVER='8.37'         # Version of PCRE used for pcre-jit support in Nginx
NGINX_HEADERSMORE='0.28'
NGINX_CACHEPURGEVER='2.3'
NGINX_STICKY='n'             # nginx sticky module https://bitbucket.org/nginx-goodies/nginx-sticky-module-ng
NGINX_STICKYVER='1.2.5'
NGINX_UPSTREAMCHECK='y'      # nginx upstream check https://github.com/yaoweibin/nginx_upstream_check_module
NGINX_UPSTREAMCHECKVER='0.3.0'
NGINX_OPENRESTY='y'          # Agentzh's openresty Nginx modules

Step 2: recompile Nginx

cd /usr/local/src/centminmod/
./centmin.sh

Go to menu 4

[root@tutorialspots centminmod]# ./centmin.sh

--------------------------------------------------------
Centmin Mod 1.2.3-eva2000.08 - http://centminmod.com
--------------------------------------------------------
                   Centmin Mod Menu
--------------------------------------------------------
1).  Centmin Install
2).  Add Nginx vhost domain
3).  NSD setup domain name DNS
4).  Nginx Upgrade / Downgrade
5).  PHP Upgrade / Downgrade
6).  XCache Re-install
7).  APC Cache Re-install
8).  XCache Install
9).  APC Cache Install
10). Memcached Server Re-install
11). MariaDB 5.2/5.5 & 10.x Upgrade Sub-Menu
12). Zend OpCache Install/Re-install
13). Install ioping.sh vbtechsupport.com/1239/
14). SELinux disable
15). Install/Reinstall ImagicK PHP Extension
16). Change SSHD Port Number
17). Multi-thread compression: pigz,pbzip2,lbzip2...
18). Suhosin PHP Extension install
19). Install FFMPEG and FFMPEG PHP Extension
20). NSD Re-install
21). Update - Nginx + PHP-FPM + Siege
22). Add WordPress Nginx vhost + WP Super Cache
23). Update Centmin Mod Code Base
24). Exit
--------------------------------------------------------
Enter option [ 1 - 24 ] 4
--------------------------------------------------------
Custom configure CSF settings...set

Do you want to run YUM install checks ?  [y/n]

This will increase your upgrade duration time wise.
Check the change log centminmod.com/changelog.html
to see if any Nginx or PHP related new additions
which require checking YUM prequisites are met.
If no new additions made, you can skip the
YUM install check to speed up upgrade time.

 [y/n]:

Type y, then, Nginx will be recompile.

--------------------------------------------------------------------------------
--
{expect,expect-devel} already installed
--------------------------------------------------------------------------------
--
Processing package: {readline,readline-devel}
--------------------------------------------------------------------------------
--
{readline,readline-devel} already installed
--------------------------------------------------------------------------------
--
Processing package: {libedit,libedit-devel}
--------------------------------------------------------------------------------
--
{libedit,libedit-devel} already installed
--------------------------------------------------------------------------------
--
Processing package: {openssl,openssl-devel}
--------------------------------------------------------------------------------
--
{openssl,openssl-devel} already installed
--------------------------------------------------------------------------------
--
Processing package: {curl,curl-devel}
--------------------------------------------------------------------------------
--
Installing {curl,curl-devel}
--------------------------------------------------------------------------------
--
Package curl-7.19.7-46.el6.i686 already installed and latest version
Package libcurl-devel-7.19.7-46.el6.i686 already installed and latest version
--------------------------------------------------------------------------------
--
Processing package: {openldap,openldap-devel}
--------------------------------------------------------------------------------
--
{openldap,openldap-devel} already installed
--------------------------------------------------------------------------------
--
Processing package: {zlib,zlib-devel}
--------------------------------------------------------------------------------
--
{zlib,zlib-devel} already installed
--------------------------------------------------------------------------------
--
Processing package: {gd,gd-devel}
--------------------------------------------------------------------------------
--
{gd,gd-devel} already installed
--------------------------------------------------------------------------------
--
Processing package: {pcre,pcre-devel}
--------------------------------------------------------------------------------
--
{pcre,pcre-devel} already installed
--------------------------------------------------------------------------------
--
Processing package: {gettext,gettext-devel}
--------------------------------------------------------------------------------
--
{gettext,gettext-devel} already installed
--------------------------------------------------------------------------------
--
Processing package: {libidn,libidn-devel}
--------------------------------------------------------------------------------
--
{libidn,libidn-devel} already installed
--------------------------------------------------------------------------------
--
Processing package: {libjpeg,libjpeg-devel}
--------------------------------------------------------------------------------
--
Installing {libjpeg,libjpeg-devel}
--------------------------------------------------------------------------------
--
Package libjpeg-turbo-1.2.1-3.el6_5.i686 already installed and latest version
Package libjpeg-turbo-devel-1.2.1-3.el6_5.i686 already installed and latest vers
ion
--------------------------------------------------------------------------------
--
Processing package: {libpng,libpng-devel}
--------------------------------------------------------------------------------
--
{libpng,libpng-devel} already installed
--------------------------------------------------------------------------------
--
Processing package: {freetype,freetype-devel}
--------------------------------------------------------------------------------
--
{freetype,freetype-devel} already installed
--------------------------------------------------------------------------------
--
Processing package: {libxml2,libxml2-devel}
--------------------------------------------------------------------------------
--
{libxml2,libxml2-devel} already installed
--------------------------------------------------------------------------------
--
Processing package: {glib2,glib2-devel}
--------------------------------------------------------------------------------
--
{glib2,glib2-devel} already installed
--------------------------------------------------------------------------------
--
Processing package: {bzip2,bzip2-devel}
--------------------------------------------------------------------------------
--
{bzip2,bzip2-devel} already installed
--------------------------------------------------------------------------------
--
Processing package: {ncurses,ncurses-devel}
--------------------------------------------------------------------------------
--
{ncurses,ncurses-devel} already installed
--------------------------------------------------------------------------------
--
Processing package: {e2fsprogs,e2fsprogs-devel}
--------------------------------------------------------------------------------
--
{e2fsprogs,e2fsprogs-devel} already installed
--------------------------------------------------------------------------------
--
Processing package: {libc-client,libc-client-devel}
--------------------------------------------------------------------------------
--
{libc-client,libc-client-devel} already installed
--------------------------------------------------------------------------------
--
Processing package: {ImageMagicklast,ImageMagick-last-devel}
--------------------------------------------------------------------------------
--
Installing {ImageMagicklast,ImageMagick-last-devel}
--------------------------------------------------------------------------------
--
--------------------------------------------------------------------------------
--
Processing package: {ImageMagick-last-c++,ImageMagick-last-c++-devel}
--------------------------------------------------------------------------------
--
{ImageMagick-last-c++,ImageMagick-last-c++-devel} already installed
--------------------------------------------------------------------------------
--
Processing package: {cyrus-sasl,cyrus-sasl-devel}
--------------------------------------------------------------------------------
--
{cyrus-sasl,cyrus-sasl-devel} already installed
--------------------------------------------------------------------------------
--
Processing package: {pam,pam-devel}
--------------------------------------------------------------------------------
--
{pam,pam-devel} already installed
--------------------------------------------------------------------------------
--
Processing package: {libaio,libaio-devel}
--------------------------------------------------------------------------------
--
{libaio,libaio-devel} already installed
--------------------------------------------------------------------------------
--
Processing package: {libevent,libevent-devel}
--------------------------------------------------------------------------------
--
{libevent,libevent-devel} already installed
--------------------------------------------------------------------------------
--
Processing package: {recode,recode-devel}
--------------------------------------------------------------------------------
--
{recode,recode-devel} already installed
--------------------------------------------------------------------------------
--
Processing package: {libtidy,libtidy-devel}
--------------------------------------------------------------------------------
--
{libtidy,libtidy-devel} already installed
--------------------------------------------------------------------------------
--
Processing package: {net-snmp,net-snmp-devel}
--------------------------------------------------------------------------------
--
{net-snmp,net-snmp-devel} already installed
--------------------------------------------------------------------------------
--
Processing package: {enchant,enchant-devel}
--------------------------------------------------------------------------------
--
{enchant,enchant-devel} already installed
--------------------------------------------------------------------------------
--
Processing package: {lua,lua-devel}
--------------------------------------------------------------------------------
--
{lua,lua-devel} already installed
--------------------------------------------------------------------------------
--
Package mytop-1.7-3.b737f60.el6.noarch already installed and latest version
Package iftop-1.0-0.7.pre4.el6.i686 already installed and latest version
*************************************************
* CentOS 6.x detected installing EPEL Repo
*************************************************
rpmforge-release-0.5.3-1.el6.rf.i686.rpm [found]
setting yum priorities for rpmforge.repo
[rpmforge]
name = RHEL $releasever - RPMforge.net - dag
baseurl = http://apt.sw.be/redhat/el6/en/$basearch/rpmforge
mirrorlist = http://mirrorlist.repoforge.org/el6/mirrors-rpmforge
#mirrorlist = file:///etc/yum.repos.d/mirrors-rpmforge
enabled = 1
protect = 0
gpgkey = file:///etc/pki/rpm-gpg/RPM-GPG-KEY-rpmforge-dag
gpgcheck = 1
*************************************************
Fixing rpmforge.repo YUM Priorities
*************************************************
### Name: RPMforge RPM Repository for RHEL 6 - dag
### URL: http://rpmforge.net/
[rpmforge]
name = RHEL $releasever - RPMforge.net - dag
baseurl = http://apt.sw.be/redhat/el6/en/$basearch/rpmforge
mirrorlist = http://mirrorlist.repoforge.org/el6/mirrors-rpmforge
#mirrorlist = file:///etc/yum.repos.d/mirrors-rpmforge
enabled = 1
protect = 0
gpgkey = file:///etc/pki/rpm-gpg/RPM-GPG-KEY-rpmforge-dag
gpgcheck = 1
priority=5
exclude=pure-ftpd optipng

[rpmforge-extras]
name = RHEL $releasever - RPMforge.net - extras
baseurl = http://apt.sw.be/redhat/el6/en/$basearch/extras
mirrorlist = http://mirrorlist.repoforge.org/el6/mirrors-rpmforge-extras
#mirrorlist = file:///etc/yum.repos.d/mirrors-rpmforge-extras
enabled = 0
protect = 0
gpgkey = file:///etc/pki/rpm-gpg/RPM-GPG-KEY-rpmforge-dag
gpgcheck = 1

[rpmforge-testing]
name = RHEL $releasever - RPMforge.net - testing
baseurl = http://apt.sw.be/redhat/el6/en/$basearch/testing
mirrorlist = http://mirrorlist.repoforge.org/el6/mirrors-rpmforge-testing
#mirrorlist = file:///etc/yum.repos.d/mirrors-rpmforge-testing
enabled = 0
protect = 0
gpgkey = file:///etc/pki/rpm-gpg/RPM-GPG-KEY-rpmforge-dag
gpgcheck = 1


percona-release-0.1-3.noarch.rpm [found]
        package percona-release-0.1-3.noarch is already installed
Error: problem with percona-release-0.1-3.noarch.rpm install.
GeoIP database and library install...
Package GeoIP-1.6.5-1.el6.i686 already installed and latest version
Package GeoIP-devel-1.6.5-1.el6.i686 already installed and latest version
/usr/include/GeoIP.h
/usr/include/GeoIPCity.h
/usr/lib/libGeoIP.so
/usr/lib/pkgconfig/geoip.pc
/usr/bin/geoiplookup
/usr/bin/geoiplookup6
/usr/lib/libGeoIP.so.1
/usr/lib/libGeoIP.so.1.6.5
/usr/share/doc/GeoIP-1.6.5
/usr/share/doc/GeoIP-1.6.5/AUTHORS
/usr/share/doc/GeoIP-1.6.5/COPYING
/usr/share/doc/GeoIP-1.6.5/ChangeLog
/usr/share/doc/GeoIP-1.6.5/NEWS.md
/usr/share/doc/GeoIP-1.6.5/README.md
/usr/share/man/man1/geoiplookup.1.gz
/usr/share/man/man1/geoiplookup6.1.gz
GeoLiteCity database download ...
2016-02-15 07:36:44 URL:http://geolite.maxmind.com/download/geoip/database/GeoLi
teCity.dat.gz [12319715/12319715] -> "/usr/share/GeoIP/GeoLiteCity.dat.gz" [1]
cp: `/usr/share/GeoIP/GeoLiteCity.dat' and `/usr/share/GeoIP/GeoIPCity.dat' are
the same file

custom RPM installs

rpm -Uvh /svr-setup/rpms/re2c/re2c-0.14.3-1.el6.x86_64.rpm
error: Failed dependencies:
        libc.so.6()(64bit) is needed by re2c-0.14.3-1.x86_64
        libc.so.6(GLIBC_2.2.5)(64bit) is needed by re2c-0.14.3-1.x86_64
        libgcc_s.so.1()(64bit) is needed by re2c-0.14.3-1.x86_64
        libgcc_s.so.1(GCC_3.0)(64bit) is needed by re2c-0.14.3-1.x86_64
        libm.so.6()(64bit) is needed by re2c-0.14.3-1.x86_64
        libstdc++.so.6()(64bit) is needed by re2c-0.14.3-1.x86_64
        libstdc++.so.6(CXXABI_1.3)(64bit) is needed by re2c-0.14.3-1.x86_64
        libstdc++.so.6(GLIBCXX_3.4)(64bit) is needed by re2c-0.14.3-1.x86_64
        libstdc++.so.6(GLIBCXX_3.4.11)(64bit) is needed by re2c-0.14.3-1.x86_64
        libstdc++.so.6(GLIBCXX_3.4.9)(64bit) is needed by re2c-0.14.3-1.x86_64
Loaded plugins: fastestmirror, security
Setting up Update Process
Loading mirror speeds from cached hostfile
 * base: mirror1.babylon.network
 * epel: mirror1.babylon.network
 * extras: mirror1.babylon.network
 * remi: rpms.remirepo.net
 * rpmforge: www.mirrorservice.org
 * updates: mirror1.babylon.network
No Packages marked for Update
Loaded plugins: fastestmirror, priorities, security
Setting up Update Process
Loading mirror speeds from cached hostfile
 * base: mirror1.babylon.network
 * epel: mirror1.babylon.network
 * extras: mirror1.babylon.network
 * rpmforge: www.mirrorservice.org
 * updates: mirror1.babylon.network
1626 packages excluded due to repository priority protections
No Packages marked for Update
cp: cannot stat `/var/cache/yum/timedhosts.txt': No such file or directory
-rw-r--r-- 1 root root 29K Feb 15 07:36 /root/centminlogs/centminmod_yumtimes_15
0216-073500.log
**********************************************************************
* Nginx Update script - Included in Centmin Extras
* Version: 1.2.3-eva2000.08 - Date: 31/07/2015 - Copyright 2011-2015 CentminMod.
com
**********************************************************************

This software comes with no warranty of any kind. You are free to use
it for both personal and commercial use as licensed under the GPL.

Nginx Upgrade - Would you like to continue? [y/n]y

Install which version of Nginx? (version i.e. 1.9.11}): 1.9.10

Type your version you want to install like 1.9.10. Wait a few minutes.

...
Mon Feb 15 07:50:23 UTC 2016
Success: Nginx make ok

make -f objs/Makefile install
make[1]: Entering directory `/svr-setup/nginx-1.9.10'
test -d '/usr/local/nginx' || mkdir -p '/usr/local/nginx'
test -d '/usr/local/sbin'               || mkdir -p '/usr/local/sbin'
test ! -f '/usr/local/sbin/nginx'               || mv '/usr/local/sbin/nginx'  '
/usr/local/sbin/nginx.old'
cp objs/nginx '/usr/local/sbin/nginx'
test -d '/usr/local/nginx/conf'                 || mkdir -p '/usr/local/nginx/co
nf'
cp conf/koi-win '/usr/local/nginx/conf'
cp conf/koi-utf '/usr/local/nginx/conf'
cp conf/win-utf '/usr/local/nginx/conf'
test -f '/usr/local/nginx/conf/mime.types'              || cp conf/mime.types '/
usr/local/nginx/conf'
cp conf/mime.types '/usr/local/nginx/conf/mime.types.default'
test -f '/usr/local/nginx/conf/fastcgi_params'          || cp conf/fastcgi_param
s '/usr/local/nginx/conf'
cp conf/fastcgi_params          '/usr/local/nginx/conf/fastcgi_params.default'
test -f '/usr/local/nginx/conf/fastcgi.conf'            || cp conf/fastcgi.conf
'/usr/local/nginx/conf'
cp conf/fastcgi.conf '/usr/local/nginx/conf/fastcgi.conf.default'
test -f '/usr/local/nginx/conf/uwsgi_params'            || cp conf/uwsgi_params
'/usr/local/nginx/conf'
cp conf/uwsgi_params            '/usr/local/nginx/conf/uwsgi_params.default'
test -f '/usr/local/nginx/conf/scgi_params'             || cp conf/scgi_params '
/usr/local/nginx/conf'
cp conf/scgi_params             '/usr/local/nginx/conf/scgi_params.default'
test -f '/usr/local/nginx/conf/nginx.conf'              || cp conf/nginx.conf '/
usr/local/nginx/conf/nginx.conf'
cp conf/nginx.conf '/usr/local/nginx/conf/nginx.conf.default'
test -d '/usr/local/nginx/logs'                 || mkdir -p '/usr/local/nginx/lo
gs'
test -d '/usr/local/nginx/logs' ||              mkdir -p '/usr/local/nginx/logs'
test -d '/usr/local/nginx/html'                 || cp -R html '/usr/local/nginx'
test -d '/usr/local/nginx/logs' ||              mkdir -p '/usr/local/nginx/logs'
make[1]: Leaving directory `/svr-setup/nginx-1.9.10'

real    0m0.048s
user    0m0.029s
sys     0m0.005s

Mon Feb 15 07:50:26 UTC 2016
Success: Nginx was installed properly

/usr/local/nginx/conf/conf.d/demodomain.com.conf
---
/usr/local/nginx/conf/conf.d/tutorialspots.com.conf
---
/usr/local/nginx/conf/conf.d/tutorialspots.com.ssl.conf
26:  ##add_header Alternate-Protocol  443:npn-spdy/3;
30:  ##spdy_headers_comp 5;
---
15:  listen 443 ssl http2;
26:  ###add_header Alternate-Protocol  443:npn-spdy/3;
30:  ###spdy_headers_comp 5;
/usr/local/nginx/conf/conf.d/ssl.conf
---
/usr/local/nginx/conf/conf.d/virtual.conf
---
Starting nginx:                                            [  OK  ]
*************************************************
* nginx updated
*************************************************

Leave a Reply