ICode9

精准搜索请尝试: 精确搜索
首页 > 系统相关> 文章详细

从Puppet nginx模块中删除“ipv6only”选项

2019-08-16 23:10:37  阅读:219  来源: 互联网

标签:nginx puppet ipv6 vhost


我的nginx服务器(提供多个虚拟主机)无法启动:

Nov 08 23:54:43 foo systemd[1]: Starting nginx - high performance web server...
Nov 08 23:54:43 foo nginx[3830]: nginx: [emerg] duplicate listen options for [::]:8081 in /etc/nginx/sites-enabled/000-mysite.vhost:3
Nov 08 23:54:43 foo nginx[3830]: nginx: configuration file /etc/nginx/nginx.conf test failed
Nov 08 23:54:43 foo systemd[1]: nginx.service: control process exited, code=exited status=1
Nov 08 23:54:43 foo systemd[1]: Failed to start nginx - high performance web server.
Nov 08 23:54:43 foo systemd[1]: Unit nginx.service entered failed state.
Nov 08 23:54:43 foo systemd[1]: nginx.service failed.

我已经确定了两个绑定到IPv4和IPv6的相同TCP端口的listen指令的问题,其中使用了选项ipv6only:

[root@foo ~]# head /etc/nginx/sites-enabled/mysite.vhost 
server {
        listen 8081;
        listen [::]:8081 ipv6only=on;  
        ssl off;
...

所以这个配置正常工作:

[root@foo ~]# head /etc/nginx/sites-enabled/mysite.vhost 
server {
        listen 8081;
        listen [::]:8081;  
        ssl off;
...

[相关问题:https://serverfault.com/questions/638367/do-you-need-separate-ipv4-and-ipv6-listen-directives-in-nginx]

现在,这个配置由Puppet通过puppet-nginx module提供.有没有办法(通过Puppet)不指定ipv6only选项,或以另一种方式解决问题?

解决方法:

我无法说出你的傀儡部分是什么样的.无论如何,puppet-nginx模块有资源nginx :: resource :: vhost,我想 – 你以某种方式使用它.此资源具有选项ipv6_listen_options,其为includes ipv6only=on by default.因此您应该能够以这种方式调用它:

nginx::resource::vhost { 'example.com':
    ipv6_listen_options => '',
    # another options there
}

另一种可能性是你使用较旧的模块,其中ipv6only =在模板中硬编码.它在2月份修复了this pull request.所以你可以从模板或升级模块中删除它.

标签:nginx,puppet,ipv6,vhost
来源: https://codeday.me/bug/20190816/1671762.html

本站声明: 1. iCode9 技术分享网(下文简称本站)提供的所有内容,仅供技术学习、探讨和分享;
2. 关于本站的所有留言、评论、转载及引用,纯属内容发起人的个人观点,与本站观点和立场无关;
3. 关于本站的所有言论和文字,纯属内容发起人的个人观点,与本站观点和立场无关;
4. 本站文章均是网友提供,不完全保证技术分享内容的完整性、准确性、时效性、风险性和版权归属;如您发现该文章侵犯了您的权益,可联系我们第一时间进行删除;
5. 本站为非盈利性的个人网站,所有内容不会用来进行牟利,也不会利用任何形式的广告来间接获益,纯粹是为了广大技术爱好者提供技术内容和技术思想的分享性交流网站。

专注分享技术,共同学习,共同进步。侵权联系[81616952@qq.com]

Copyright (C)ICode9.com, All Rights Reserved.

ICode9版权所有