使WDCP的lnmp环境支持ipv6协议访问

2015年3月23日21:29:39网站建设评论650

随着ipv4地址的枯竭(喊了这么多年的即将枯竭,怎么现在还没枯竭),ipv6的商用步伐越来越快,很多大站都已经支持通过ipv6访问(例如:腾讯网),越来越多的VPS也开始支持ipv6协议,国外的就不说了,国内景安VPS就可以通过一个ipv4地址领取32个ipv6地址。拿到了ipv6地址,怎么让自己的vps支持ipv6呢?今天就介绍一下怎样使WDCP的lnmp环境支持ipv6协议访问。文章源自堕落的鱼-https://www.duoluodeyu.com/1208.html

1、确认你的lnmp环境是否已经支持ipv6,SSH窗口输入以下指令:文章源自堕落的鱼-https://www.duoluodeyu.com/1208.html

/www/wdlinux/nginx/sbin/nginx -V文章源自堕落的鱼-https://www.duoluodeyu.com/1208.html

如果主机返回以下信息说明没有把nginx的ipv6模块编译进去,我们需要重新编译nginx,为其添加ipv6模块
如果。如果你的vps返回的信息带有 “ --with-ipv6”则说明ipv6模块已被添加。你也可以忽略本文后续的内容了。文章源自堕落的鱼-https://www.duoluodeyu.com/1208.html

./configure --user=www --group=www --prefix=/www/wdlinux/nginx-1.2.9 --with-http_stub_status_module --with-http_ssl_module --with-ipv6文章源自堕落的鱼-https://www.duoluodeyu.com/1208.html

2、进入nginx的安装目录,一般情况下为/root/lanmp/nginx-1.2.9(请根据自己的实际情况选择目录)文章源自堕落的鱼-https://www.duoluodeyu.com/1208.html

cd /root/lanmp/nginx-1.2.9文章源自堕落的鱼-https://www.duoluodeyu.com/1208.html

执行以下指令:文章源自堕落的鱼-https://www.duoluodeyu.com/1208.html

./configure --user=www --group=www --prefix=/www/wdlinux/nginx-1.2.9 --with-http_stub_status_module --with-http_ssl_module --with-ipv6文章源自堕落的鱼-https://www.duoluodeyu.com/1208.html

返回正确信息,接着输入make编译:文章源自堕落的鱼-https://www.duoluodeyu.com/1208.html

make文章源自堕落的鱼-https://www.duoluodeyu.com/1208.html

编译完会后会在objs目录下生成一个nginx执行文件,为了安全我们先执行如下指令备份原来老的nginx文件:文章源自堕落的鱼-https://www.duoluodeyu.com/1208.html

mv /www/wdlinux/nginx-1.2.9/sbin/nginx  /www/wdlinux/nginx-1.2.9/sbin/nginx.old文章源自堕落的鱼-https://www.duoluodeyu.com/1208.html

按后再把上一步生成在objs目录下的nginx复制到/www/wdlinux/nginx-1.2.9/sbin/下:文章源自堕落的鱼-https://www.duoluodeyu.com/1208.html

cp objs/nginx /www/wdlinux/nginx-1.2.9/sbin/nginx文章源自堕落的鱼-https://www.duoluodeyu.com/1208.html

3、确认是否编译成功:文章源自堕落的鱼-https://www.duoluodeyu.com/1208.html

/www/wdlinux/nginx/sbin/nginx -t文章源自堕落的鱼-https://www.duoluodeyu.com/1208.html

如果vps主机返回如下信息,则说明nginx已经编译成功:文章源自堕落的鱼-https://www.duoluodeyu.com/1208.html

nginx: the configuration file /www/wdlinux/nginx-1.2.9/conf/nginx.conf syntax is ok文章源自堕落的鱼-https://www.duoluodeyu.com/1208.html

nginx: configuration file /www/wdlinux/nginx-1.2.9/conf/nginx.conf test is successful文章源自堕落的鱼-https://www.duoluodeyu.com/1208.html

4、查看nginx是否已经添加ipv6模块:文章源自堕落的鱼-https://www.duoluodeyu.com/1208.html

/www/wdlinux/nginx/sbin/nginx -V文章源自堕落的鱼-https://www.duoluodeyu.com/1208.html

返回如下信息,说明已经添加ipv6模块:文章源自堕落的鱼-https://www.duoluodeyu.com/1208.html

configure arguments: --user=www --group=www --prefix=/www/wdlinux/nginx-1.2.9 --with-http_stub_status_module --with-http_ssl_module --with-ipv6文章源自堕落的鱼-https://www.duoluodeyu.com/1208.html

最后执行如下指令:文章源自堕落的鱼-https://www.duoluodeyu.com/1208.html

make upgrade文章源自堕落的鱼-https://www.duoluodeyu.com/1208.html

至此,你的wdcp的lnmp环境已经支持ipv6协议的访问了。文章源自堕落的鱼-https://www.duoluodeyu.com/1208.html

另外请注意你的nginx版本,本文演示使用的是nginx 1.2.9版本,如果你的不是这个版本,请将上述指令中的nginx版本号改成你的版本号。文章源自堕落的鱼-https://www.duoluodeyu.com/1208.html

相关阅读:文章源自堕落的鱼-https://www.duoluodeyu.com/1208.html

Nginx怎样配置网站支持ipv6访问文章源自堕落的鱼-https://www.duoluodeyu.com/1208.html

匿名

发表评论

匿名网友 填写信息

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定