From 7981f4662b32f5eda46042e4459d02b0fdf8e6bc Mon Sep 17 00:00:00 2001 From: Jesse Young Date: Thu, 27 Oct 2011 21:32:53 +0000 Subject: main/nginx: default listen on :::80 rather than 0.0.0.0:80 Signed-off-by: Jesse Young --- main/nginx/APKBUILD | 6 ++++-- main/nginx/ipv6.patch | 42 ++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 46 insertions(+), 2 deletions(-) create mode 100644 main/nginx/ipv6.patch (limited to 'main/nginx') diff --git a/main/nginx/APKBUILD b/main/nginx/APKBUILD index d6727fb4e..c2a9dda17 100644 --- a/main/nginx/APKBUILD +++ b/main/nginx/APKBUILD @@ -16,14 +16,15 @@ source="http://nginx.org/download/$pkgname-$pkgver.tar.gz nginx.initd nginx.logrotate $install + ipv6.patch " - _builddir="$srcdir"/$pkgname-$pkgver prepare() { cd "$_builddir" # apply patches here + patch -Np1 -i "$srcdir"/ipv6.patch } build() { @@ -58,4 +59,5 @@ package() { md5sums="d23f6e6b07b57ac061e790b1ed64bb98 nginx-1.0.4.tar.gz b06f6e23753385be0076539ba1806cb6 nginx.initd -8823274a834332d3db4f62bf7dd1fb7d nginx.logrotate" +8823274a834332d3db4f62bf7dd1fb7d nginx.logrotate +39352885998d36ea3415cd50d0d5049b ipv6.patch" diff --git a/main/nginx/ipv6.patch b/main/nginx/ipv6.patch new file mode 100644 index 000000000..9b05f8ff8 --- /dev/null +++ b/main/nginx/ipv6.patch @@ -0,0 +1,42 @@ +--- a/src/http/ngx_http_core_module.c ++++ b/src/http/ngx_http_core_module.c +@@ -2442,7 +2442,11 @@ + ngx_uint_t i; + ngx_conf_t pcf; + ngx_http_module_t *module; ++#if (NGX_HAVE_INET6) ++ struct sockaddr_in6 *sin6; ++#else + struct sockaddr_in *sin; ++#endif + ngx_http_conf_ctx_t *ctx, *http_ctx; + ngx_http_listen_opt_t lsopt; + ngx_http_core_srv_conf_t *cscf, **cscfp; +@@ -2526,6 +2530,19 @@ + if (rv == NGX_CONF_OK && !cscf->listen) { + ngx_memzero(&lsopt, sizeof(ngx_http_listen_opt_t)); + ++#if (NGX_HAVE_INET6) ++ sin6 = &lsopt.u.sockaddr_in6; ++ ++ sin6->sin6_family = AF_INET6; ++#if (NGX_WIN32) ++ sin6->sin6_port = htons(80); ++#else ++ sin6->sin6_port = htons((getuid() == 0) ? 80 : 8000); ++#endif ++ sin6->sin6_addr = in6addr_any; ++ ++ lsopt.socklen = sizeof(struct sockaddr_in6); ++#else + sin = &lsopt.u.sockaddr_in; + + sin->sin_family = AF_INET; +@@ -2537,6 +2554,7 @@ + sin->sin_addr.s_addr = INADDR_ANY; + + lsopt.socklen = sizeof(struct sockaddr_in); ++#endif + + lsopt.backlog = NGX_LISTEN_BACKLOG; + lsopt.rcvbuf = -1; -- cgit v1.2.3