diff options
Diffstat (limited to 'www-servers/nginx/files')
-rw-r--r-- | www-servers/nginx/files/AJP-nginx-1.7.9+.patch | 184 | ||||
-rw-r--r-- | www-servers/nginx/files/check-1.9.2.patch | 242 | ||||
-rw-r--r-- | www-servers/nginx/files/check_1.7.2+.patch | 201 | ||||
-rw-r--r-- | www-servers/nginx/files/lua-nginx-1.7.6.patch | 39 | ||||
-rw-r--r-- | www-servers/nginx/files/nginx-1.4.1-fix-perl-install-path.patch | 13 | ||||
-rw-r--r-- | www-servers/nginx/files/nginx.conf | 72 | ||||
-rw-r--r-- | www-servers/nginx/files/nginx.initd-r2 | 89 | ||||
-rw-r--r-- | www-servers/nginx/files/nginx.logrotate-r1 | 12 | ||||
-rw-r--r-- | www-servers/nginx/files/nginx.service-r1 | 14 | ||||
-rw-r--r-- | www-servers/nginx/files/rtmp-nginx-1.7.6.patch | 89 |
10 files changed, 955 insertions, 0 deletions
diff --git a/www-servers/nginx/files/AJP-nginx-1.7.9+.patch b/www-servers/nginx/files/AJP-nginx-1.7.9+.patch new file mode 100644 index 000000000000..35460fc5ad80 --- /dev/null +++ b/www-servers/nginx/files/AJP-nginx-1.7.9+.patch @@ -0,0 +1,184 @@ +From bf6cd93f2098b59260de8d494f0f4b1f11a84627 Mon Sep 17 00:00:00 2001 +From: Weibin Yao <yaoweibin@gmail.com> +Date: Fri, 27 Feb 2015 23:13:30 +0800 +Subject: [PATCH] fixed the compatible problem with nginx-1.7.9+ + +--- + ngx_http_ajp.h | 1 + + ngx_http_ajp_module.c | 85 +++++++++++++++++++++++++++++++++++++++++++++++++++ + 2 files changed, 86 insertions(+) + +diff --git a/ngx_http_ajp.h b/ngx_http_ajp.h +index 72502ad..b3c7051 100644 +--- a/ngx_http_ajp.h ++++ b/ngx_http_ajp.h +@@ -5,6 +5,7 @@ + #include <ngx_config.h> + #include <ngx_core.h> + #include <ngx_http.h> ++#include <nginx.h> + #include "ngx_http_ajp_module.h" + + #define AJP13_DEF_HOST "127.0.0.1" +diff --git a/ngx_http_ajp_module.c b/ngx_http_ajp_module.c +index e4d5b00..be32459 100644 +--- a/ngx_http_ajp_module.c ++++ b/ngx_http_ajp_module.c +@@ -464,8 +464,12 @@ ngx_http_ajp_store(ngx_conf_t *cf, ngx_command_t *cmd, void *conf) + + #if (NGX_HTTP_CACHE) + ++#if (nginx_version >= 1007009) ++ if (alcf->upstream.cache > 0) ++#else + if (alcf->upstream.cache != NGX_CONF_UNSET_PTR + && alcf->upstream.cache != NULL) ++#endif + { + return "is incompatible with \"ajp_cache\""; + } +@@ -534,15 +538,27 @@ ngx_http_ajp_cache(ngx_conf_t *cf, ngx_command_t *cmd, void *conf) + ngx_http_ajp_loc_conf_t *alcf = conf; + + ngx_str_t *value; ++#if (nginx_version >= 1007009) ++ ngx_http_complex_value_t cv; ++ ngx_http_compile_complex_value_t ccv; ++#endif + + value = cf->args->elts; + ++#if (nginx_version >= 1007009) ++ if (alcf->upstream.cache != NGX_CONF_UNSET) { ++#else + if (alcf->upstream.cache != NGX_CONF_UNSET_PTR) { ++#endif + return "is duplicate"; + } + + if (ngx_strcmp(value[1].data, "off") == 0) { ++#if (nginx_version >= 1007009) ++ alcf->upstream.cache = 0; ++#else + alcf->upstream.cache = NULL; ++#endif + return NGX_CONF_OK; + } + +@@ -550,11 +566,44 @@ ngx_http_ajp_cache(ngx_conf_t *cf, ngx_command_t *cmd, void *conf) + return "is incompatible with \"ajp_store\""; + } + ++#if (nginx_version >= 1007009) ++ alcf->upstream.cache = 1; ++ ++ ngx_memzero(&ccv, sizeof(ngx_http_compile_complex_value_t)); ++ ++ ccv.cf = cf; ++ ccv.value = &value[1]; ++ ccv.complex_value = &cv; ++ ++ if (ngx_http_compile_complex_value(&ccv) != NGX_OK) { ++ return NGX_CONF_ERROR; ++ } ++ ++ if (cv.lengths != NULL) { ++ ++ alcf->upstream.cache_value = ngx_palloc(cf->pool, ++ sizeof(ngx_http_complex_value_t)); ++ if (alcf->upstream.cache_value == NULL) { ++ return NGX_CONF_ERROR; ++ } ++ ++ *alcf->upstream.cache_value = cv; ++ ++ return NGX_CONF_OK; ++ } ++ ++ alcf->upstream.cache_zone = ngx_shared_memory_add(cf, &value[1], 0, ++ &ngx_http_ajp_module); ++ if (alcf->upstream.cache_zone == NULL) { ++ return NGX_CONF_ERROR; ++ } ++#else + alcf->upstream.cache = ngx_shared_memory_add(cf, &value[1], 0, + &ngx_http_ajp_module); + if (alcf->upstream.cache == NULL) { + return NGX_CONF_ERROR; + } ++#endif + + return NGX_CONF_OK; + } +@@ -666,7 +715,11 @@ ngx_http_ajp_create_loc_conf(ngx_conf_t *cf) + conf->upstream.pass_request_body = NGX_CONF_UNSET; + + #if (NGX_HTTP_CACHE) ++#if (nginx_version >= 1007009) ++ conf->upstream.cache = NGX_CONF_UNSET; ++#else + conf->upstream.cache = NGX_CONF_UNSET_PTR; ++#endif + conf->upstream.cache_min_uses = NGX_CONF_UNSET_UINT; + conf->upstream.cache_valid = NGX_CONF_UNSET_PTR; + conf->upstream.cache_lock = NGX_CONF_UNSET; +@@ -699,6 +752,18 @@ ngx_http_ajp_merge_loc_conf(ngx_conf_t *cf, void *parent, void *child) + ngx_str_t *h; + ngx_hash_init_t hash; + ++#if (NGX_HTTP_CACHE) && (nginx_version >= 1007009) ++ ++ if (conf->upstream.store > 0) { ++ conf->upstream.cache = 0; ++ } ++ ++ if (conf->upstream.cache > 0) { ++ conf->upstream.store = 0; ++ } ++ ++#endif ++ + if (conf->upstream.store != 0) { + ngx_conf_merge_value(conf->upstream.store, + prev->upstream.store, 0); +@@ -864,6 +929,20 @@ ngx_http_ajp_merge_loc_conf(ngx_conf_t *cf, void *parent, void *child) + + #if (NGX_HTTP_CACHE) + ++#if (nginx_version >= 1007009) ++ if (conf->upstream.cache == NGX_CONF_UNSET) { ++ ngx_conf_merge_value(conf->upstream.cache, ++ prev->upstream.cache, 0); ++ ++ conf->upstream.cache_zone = prev->upstream.cache_zone; ++ conf->upstream.cache_value = prev->upstream.cache_value; ++ } ++ ++ if (conf->upstream.cache_zone && conf->upstream.cache_zone->data == NULL) { ++ ngx_shm_zone_t *shm_zone; ++ ++ shm_zone = conf->upstream.cache_zone; ++#else + ngx_conf_merge_ptr_value(conf->upstream.cache, + prev->upstream.cache, NULL); + +@@ -871,6 +950,7 @@ ngx_http_ajp_merge_loc_conf(ngx_conf_t *cf, void *parent, void *child) + ngx_shm_zone_t *shm_zone; + + shm_zone = conf->upstream.cache; ++#endif + + ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, + "\"ajp_cache\" zone \"%V\" is unknown, " +@@ -910,6 +990,11 @@ ngx_http_ajp_merge_loc_conf(ngx_conf_t *cf, void *parent, void *child) + conf->cache_key = prev->cache_key; + } + ++ if (conf->upstream.cache && conf->cache_key.value.data == NULL) { ++ ngx_conf_log_error(NGX_LOG_WARN, cf, 0, ++ "no \"fastcgi_cache_key\" for \"fastcgi_cache\""); ++ } ++ + ngx_conf_merge_value(conf->upstream.cache_lock, + prev->upstream.cache_lock, 0); + diff --git a/www-servers/nginx/files/check-1.9.2.patch b/www-servers/nginx/files/check-1.9.2.patch new file mode 100644 index 000000000000..35cb8a753af4 --- /dev/null +++ b/www-servers/nginx/files/check-1.9.2.patch @@ -0,0 +1,242 @@ +diff --git src/http/modules/ngx_http_upstream_hash_module.c src/http/modules/ngx_http_upstream_hash_module.c +index 1e2e05c..44a72e2 100644 +--- src/http/modules/ngx_http_upstream_hash_module.c ++++ src/http/modules/ngx_http_upstream_hash_module.c +@@ -9,6 +9,9 @@ + #include <ngx_core.h> + #include <ngx_http.h> + ++#if (NGX_HTTP_UPSTREAM_CHECK) ++#include "ngx_http_upstream_check_module.h" ++#endif + + typedef struct { + uint32_t hash; +@@ -235,6 +238,15 @@ ngx_http_upstream_get_hash_peer(ngx_peer_connection_t *pc, void *data) + goto next; + } + ++#if (NGX_HTTP_UPSTREAM_CHECK) ++ ngx_log_debug1(NGX_LOG_DEBUG_HTTP, pc->log, 0, ++ "get hash peer, check_index: %ui", ++ peer->check_index); ++ if (ngx_http_upstream_check_peer_down(peer->check_index)) { ++ goto next; ++ } ++#endif ++ + if (peer->max_fails + && peer->fails >= peer->max_fails + && now - peer->checked <= peer->fail_timeout) +@@ -535,6 +547,15 @@ ngx_http_upstream_get_chash_peer(ngx_peer_connection_t *pc, void *data) + continue; + } + ++#if (NGX_HTTP_UPSTREAM_CHECK) ++ ngx_log_debug1(NGX_LOG_DEBUG_HTTP, pc->log, 0, ++ "get consistent_hash peer, check_index: %ui", ++ peer->check_index); ++ if (ngx_http_upstream_check_peer_down(peer->check_index)) { ++ continue; ++ } ++#endif ++ + if (peer->server.len != server->len + || ngx_strncmp(peer->server.data, server->data, server->len) + != 0) +diff --git src/http/modules/ngx_http_upstream_ip_hash_module.c src/http/modules/ngx_http_upstream_ip_hash_module.c +index 401b58e..ba656bd 100644 +--- src/http/modules/ngx_http_upstream_ip_hash_module.c ++++ src/http/modules/ngx_http_upstream_ip_hash_module.c +@@ -9,6 +9,9 @@ + #include <ngx_core.h> + #include <ngx_http.h> + ++#if (NGX_HTTP_UPSTREAM_CHECK) ++#include "ngx_http_upstream_check_module.h" ++#endif + + typedef struct { + /* the round robin data must be first */ +@@ -205,6 +208,15 @@ ngx_http_upstream_get_ip_hash_peer(ngx_peer_connection_t *pc, void *data) + goto next; + } + ++#if (NGX_HTTP_UPSTREAM_CHECK) ++ ngx_log_debug1(NGX_LOG_DEBUG_HTTP, pc->log, 0, ++ "get ip_hash peer, check_index: %ui", ++ peer->check_index); ++ if (ngx_http_upstream_check_peer_down(peer->check_index)) { ++ goto next; ++ } ++#endif ++ + if (peer->max_fails + && peer->fails >= peer->max_fails + && now - peer->checked <= peer->fail_timeout) +diff --git src/http/modules/ngx_http_upstream_least_conn_module.c src/http/modules/ngx_http_upstream_least_conn_module.c +index 92951bd..48aca2c 100644 +--- src/http/modules/ngx_http_upstream_least_conn_module.c ++++ src/http/modules/ngx_http_upstream_least_conn_module.c +@@ -9,6 +9,9 @@ + #include <ngx_core.h> + #include <ngx_http.h> + ++#if (NGX_HTTP_UPSTREAM_CHECK) ++#include "ngx_http_upstream_check_module.h" ++#endif + + static ngx_int_t ngx_http_upstream_init_least_conn_peer(ngx_http_request_t *r, + ngx_http_upstream_srv_conf_t *us); +@@ -148,6 +151,16 @@ ngx_http_upstream_get_least_conn_peer(ngx_peer_connection_t *pc, void *data) + continue; + } + ++#if (NGX_HTTP_UPSTREAM_CHECK) ++ ngx_log_debug1(NGX_LOG_DEBUG_HTTP, pc->log, 0, ++ "get least_conn peer, check_index: %ui", ++ peer->check_index); ++ ++ if (ngx_http_upstream_check_peer_down(peer->check_index)) { ++ continue; ++ } ++#endif ++ + if (peer->max_fails + && peer->fails >= peer->max_fails + && now - peer->checked <= peer->fail_timeout) +@@ -199,6 +212,16 @@ ngx_http_upstream_get_least_conn_peer(ngx_peer_connection_t *pc, void *data) + continue; + } + ++#if (NGX_HTTP_UPSTREAM_CHECK) ++ ngx_log_debug1(NGX_LOG_DEBUG_HTTP, pc->log, 0, ++ "get least_conn peer, check_index: %ui", ++ peer->check_index); ++ ++ if (ngx_http_upstream_check_peer_down(peer->check_index)) { ++ continue; ++ } ++#endif ++ + if (peer->conns * best->weight != best->conns * peer->weight) { + continue; + } +diff --git src/http/ngx_http_upstream_round_robin.c src/http/ngx_http_upstream_round_robin.c +index d6ae33b..416572a 100644 +--- src/http/ngx_http_upstream_round_robin.c ++++ src/http/ngx_http_upstream_round_robin.c +@@ -9,6 +9,9 @@ + #include <ngx_core.h> + #include <ngx_http.h> + ++#if (NGX_HTTP_UPSTREAM_CHECK) ++#include "ngx_http_upstream_check_module.h" ++#endif + + #define ngx_http_upstream_tries(p) ((p)->number \ + + ((p)->next ? (p)->next->number : 0)) +@@ -96,7 +99,14 @@ ngx_http_upstream_init_round_robin(ngx_conf_t *cf, + peer[n].fail_timeout = server[i].fail_timeout; + peer[n].down = server[i].down; + peer[n].server = server[i].name; +- ++#if (NGX_HTTP_UPSTREAM_CHECK) ++ if (!server[i].down) { ++ peer[n].check_index = ++ ngx_http_upstream_check_add_peer(cf, us, &server[i].addrs[j]); ++ } else { ++ peer[n].check_index = (ngx_uint_t) NGX_ERROR; ++ } ++#endif + *peerp = &peer[n]; + peerp = &peer[n].next; + n++; +@@ -159,7 +169,15 @@ ngx_http_upstream_init_round_robin(ngx_conf_t *cf, + peer[n].fail_timeout = server[i].fail_timeout; + peer[n].down = server[i].down; + peer[n].server = server[i].name; +- ++#if (NGX_HTTP_UPSTREAM_CHECK) ++ if (!server[i].down) { ++ peer[n].check_index = ++ ngx_http_upstream_check_add_peer(cf, us, &server[i].addrs[j]); ++ } ++ else { ++ peer[n].check_index = (ngx_uint_t) NGX_ERROR; ++ } ++#endif + *peerp = &peer[n]; + peerp = &peer[n].next; + n++; +@@ -225,6 +243,9 @@ ngx_http_upstream_init_round_robin(ngx_conf_t *cf, + peer[i].current_weight = 0; + peer[i].max_fails = 1; + peer[i].fail_timeout = 10; ++#if (NGX_HTTP_UPSTREAM_CHECK) ++ peer[i].check_index = (ngx_uint_t) NGX_ERROR; ++#endif + *peerp = &peer[i]; + peerp = &peer[i].next; + } +@@ -339,6 +360,9 @@ ngx_http_upstream_create_round_robin_peer(ngx_http_request_t *r, + peer[0].current_weight = 0; + peer[0].max_fails = 1; + peer[0].fail_timeout = 10; ++#if (NGX_HTTP_UPSTREAM_CHECK) ++ peer[0].check_index = (ngx_uint_t) NGX_ERROR; ++#endif + peers->peer = peer; + + } else { +@@ -381,6 +405,9 @@ ngx_http_upstream_create_round_robin_peer(ngx_http_request_t *r, + peer[i].current_weight = 0; + peer[i].max_fails = 1; + peer[i].fail_timeout = 10; ++#if (NGX_HTTP_UPSTREAM_CHECK) ++ peer[i].check_index = (ngx_uint_t) NGX_ERROR; ++#endif + *peerp = &peer[i]; + peerp = &peer[i].next; + } +@@ -441,6 +468,12 @@ ngx_http_upstream_get_round_robin_peer(ngx_peer_connection_t *pc, void *data) + goto failed; + } + ++#if (NGX_HTTP_UPSTREAM_CHECK) ++ if (ngx_http_upstream_check_peer_down(peer->check_index)) { ++ goto failed; ++ } ++#endif ++ + rrp->current = peer; + + } else { +@@ -542,6 +575,12 @@ ngx_http_upstream_get_peer(ngx_http_upstream_rr_peer_data_t *rrp) + continue; + } + ++#if (NGX_HTTP_UPSTREAM_CHECK) ++ if (ngx_http_upstream_check_peer_down(peer->check_index)) { ++ continue; ++ } ++#endif ++ + if (peer->max_fails + && peer->fails >= peer->max_fails + && now - peer->checked <= peer->fail_timeout) +diff --git src/http/ngx_http_upstream_round_robin.h src/http/ngx_http_upstream_round_robin.h +index f2c573f..75e0ed6 100644 +--- src/http/ngx_http_upstream_round_robin.h ++++ src/http/ngx_http_upstream_round_robin.h +@@ -35,6 +35,10 @@ struct ngx_http_upstream_rr_peer_s { + ngx_uint_t max_fails; + time_t fail_timeout; + ++#if (NGX_HTTP_UPSTREAM_CHECK) ++ ngx_uint_t check_index; ++#endif ++ + ngx_uint_t down; /* unsigned down:1; */ + + #if (NGX_HTTP_SSL) diff --git a/www-servers/nginx/files/check_1.7.2+.patch b/www-servers/nginx/files/check_1.7.2+.patch new file mode 100644 index 000000000000..50405a5b84ae --- /dev/null +++ b/www-servers/nginx/files/check_1.7.2+.patch @@ -0,0 +1,201 @@ +commit 21116e1c0bba730ca59327ffba9320bc63f11462 +Author: Johan Bergström <bugs@bergstroem.nu> +Date: Thu Jun 19 10:17:22 2014 +1000 + + Add support for upstream_check to nginx 1.7.2 + +diff --git src/http/modules/ngx_http_upstream_ip_hash_module.c src/http/modules/ngx_http_upstream_ip_hash_module.c +index 148d73a..be9e03d 100644 +--- src/http/modules/ngx_http_upstream_ip_hash_module.c ++++ src/http/modules/ngx_http_upstream_ip_hash_module.c +@@ -9,6 +9,9 @@ + #include <ngx_core.h> + #include <ngx_http.h> + ++#if (NGX_UPSTREAM_CHECK_MODULE) ++#include "ngx_http_upstream_check_handler.h" ++#endif + + typedef struct { + /* the round robin data must be first */ +@@ -212,6 +215,15 @@ ngx_http_upstream_get_ip_hash_peer(ngx_peer_connection_t *pc, void *data) + goto next_try; + } + ++#if (NGX_UPSTREAM_CHECK_MODULE) ++ ngx_log_debug1(NGX_LOG_DEBUG_HTTP, pc->log, 0, ++ "get ip_hash peer, check_index: %ui", ++ peer->check_index); ++ if (ngx_http_check_peer_down(peer->check_index)) { ++ goto next_try; ++ } ++#endif ++ + if (peer->max_fails + && peer->fails >= peer->max_fails + && now - peer->checked <= peer->fail_timeout) +diff --git src/http/modules/ngx_http_upstream_least_conn_module.c src/http/modules/ngx_http_upstream_least_conn_module.c +index dbef95d..14e9e40 100644 +--- src/http/modules/ngx_http_upstream_least_conn_module.c ++++ src/http/modules/ngx_http_upstream_least_conn_module.c +@@ -9,6 +9,9 @@ + #include <ngx_core.h> + #include <ngx_http.h> + ++#if (NGX_UPSTREAM_CHECK_MODULE) ++#include "ngx_http_upstream_check_handler.h" ++#endif + + typedef struct { + ngx_uint_t *conns; +@@ -203,6 +206,16 @@ ngx_http_upstream_get_least_conn_peer(ngx_peer_connection_t *pc, void *data) + continue; + } + ++#if (NGX_UPSTREAM_CHECK_MODULE) ++ ngx_log_debug1(NGX_LOG_DEBUG_HTTP, pc->log, 0, ++ "get least_conn peer, check_index: %ui", ++ peer->check_index); ++ ++ if (ngx_http_check_peer_down(peer->check_index)) { ++ continue; ++ } ++#endif ++ + if (peer->max_fails + && peer->fails >= peer->max_fails + && now - peer->checked <= peer->fail_timeout) +@@ -256,6 +269,16 @@ ngx_http_upstream_get_least_conn_peer(ngx_peer_connection_t *pc, void *data) + continue; + } + ++#if (NGX_UPSTREAM_CHECK_MODULE) ++ ngx_log_debug1(NGX_LOG_DEBUG_HTTP, pc->log, 0, ++ "get least_conn peer, check_index: %ui", ++ peer->check_index); ++ ++ if (ngx_http_check_peer_down(peer->check_index)) { ++ continue; ++ } ++#endif ++ + if (lcp->conns[i] * best->weight != lcp->conns[p] * peer->weight) { + continue; + } +diff --git src/http/ngx_http_upstream_round_robin.c src/http/ngx_http_upstream_round_robin.c +index 37c835c..43ccdcf 100644 +--- src/http/ngx_http_upstream_round_robin.c ++++ src/http/ngx_http_upstream_round_robin.c +@@ -9,6 +9,9 @@ + #include <ngx_core.h> + #include <ngx_http.h> + ++#if (NGX_UPSTREAM_CHECK_MODULE) ++#include "ngx_http_upstream_check_handler.h" ++#endif + + static ngx_http_upstream_rr_peer_t *ngx_http_upstream_get_peer( + ngx_http_upstream_rr_peer_data_t *rrp); +@@ -88,6 +91,14 @@ ngx_http_upstream_init_round_robin(ngx_conf_t *cf, + peer[n].fail_timeout = server[i].fail_timeout; + peer[n].down = server[i].down; + peer[n].server = server[i].name; ++#if (NGX_UPSTREAM_CHECK_MODULE) ++ if (!server[i].down) { ++ peers->peer[n].check_index = ++ ngx_http_check_add_peer(cf, us, &server[i].addrs[j]); ++ } else { ++ peers->peer[n].check_index = (ngx_uint_t) NGX_ERROR; ++ } ++#endif + n++; + } + } +@@ -144,6 +155,15 @@ ngx_http_upstream_init_round_robin(ngx_conf_t *cf, + peer[n].fail_timeout = server[i].fail_timeout; + peer[n].down = server[i].down; + peer[n].server = server[i].name; ++#if (NGX_UPSTREAM_CHECK_MODULE) ++ if (!server[i].down) { ++ backup->peer[n].check_index = ++ ngx_http_check_add_peer(cf, us, &server[i].addrs[j]); ++ } ++ else { ++ backup->peer[n].check_index = (ngx_uint_t) NGX_ERROR; ++ } ++#endif + n++; + } + } +@@ -203,6 +223,9 @@ ngx_http_upstream_init_round_robin(ngx_conf_t *cf, + peer[i].current_weight = 0; + peer[i].max_fails = 1; + peer[i].fail_timeout = 10; ++#if (NGX_UPSTREAM_CHECK_MODULE) ++ peers->peer[i].check_index = (ngx_uint_t) NGX_ERROR; ++#endif + } + + us->peer.data = peers; +@@ -312,7 +335,9 @@ ngx_http_upstream_create_round_robin_peer(ngx_http_request_t *r, + peer[0].current_weight = 0; + peer[0].max_fails = 1; + peer[0].fail_timeout = 10; +- ++#if (NGX_UPSTREAM_CHECK_MODULE) ++ peers->peer[0].check_index = (ngx_uint_t) NGX_ERROR; ++#endif + } else { + + for (i = 0; i < ur->naddrs; i++) { +@@ -352,6 +377,9 @@ ngx_http_upstream_create_round_robin_peer(ngx_http_request_t *r, + peer[i].current_weight = 0; + peer[i].max_fails = 1; + peer[i].fail_timeout = 10; ++#if (NGX_UPSTREAM_CHECK_MODULE) ++ peers->peer[i].check_index = (ngx_uint_t) NGX_ERROR; ++#endif + } + } + +@@ -411,6 +439,12 @@ ngx_http_upstream_get_round_robin_peer(ngx_peer_connection_t *pc, void *data) + goto failed; + } + ++#if (NGX_UPSTREAM_CHECK_MODULE) ++ if (ngx_http_check_peer_down(peer->check_index)) { ++ goto failed; ++ } ++#endif ++ + } else { + + /* there are several peers */ +@@ -508,6 +542,12 @@ ngx_http_upstream_get_peer(ngx_http_upstream_rr_peer_data_t *rrp) + continue; + } + ++#if (NGX_UPSTREAM_CHECK_MODULE) ++ if (ngx_http_check_peer_down(peer->check_index)) { ++ continue; ++ } ++#endif ++ + if (peer->max_fails + && peer->fails >= peer->max_fails + && now - peer->checked <= peer->fail_timeout) +diff --git src/http/ngx_http_upstream_round_robin.h src/http/ngx_http_upstream_round_robin.h +index 9db82a6..2fedd46 100644 +--- src/http/ngx_http_upstream_round_robin.h ++++ src/http/ngx_http_upstream_round_robin.h +@@ -31,6 +31,10 @@ typedef struct { + ngx_uint_t max_fails; + time_t fail_timeout; + ++#if (NGX_UPSTREAM_CHECK_MODULE) ++ ngx_uint_t check_index; ++#endif ++ + ngx_uint_t down; /* unsigned down:1; */ + + #if (NGX_HTTP_SSL) diff --git a/www-servers/nginx/files/lua-nginx-1.7.6.patch b/www-servers/nginx/files/lua-nginx-1.7.6.patch new file mode 100644 index 000000000000..3cce343186f3 --- /dev/null +++ b/www-servers/nginx/files/lua-nginx-1.7.6.patch @@ -0,0 +1,39 @@ +From 0c4528e50dc45de322a6ae86b1fff544d777e722 Mon Sep 17 00:00:00 2001 +From: "Yichun Zhang (agentzh)" <agentzh@gmail.com> +Date: Wed, 17 Sep 2014 13:18:42 -0700 +Subject: [PATCH] bugfix: fixed compilation error with nginx 1.7.5+ because + nginx 1.7.5+ changes the API in the events subsystem. thanks Charles R. + Portwood II and Mathieu Le Marec for the report in #422. + +--- + src/ngx_http_lua_socket_tcp.c | 8 ++++++++ + 1 file changed, 8 insertions(+) + +diff --git a/src/ngx_http_lua_socket_tcp.c b/src/ngx_http_lua_socket_tcp.c +index 52cc89d..3743548 100644 +--- a/src/ngx_http_lua_socket_tcp.c ++++ b/src/ngx_http_lua_socket_tcp.c +@@ -3212,7 +3212,11 @@ ngx_http_lua_socket_tcp_finalize_read_part(ngx_http_request_t *r, + ngx_del_event(c->read, NGX_READ_EVENT, NGX_CLOSE_EVENT); + } + ++#if defined(nginx_version) && nginx_version >= 1007005 ++ if (c->read->posted) { ++#else + if (c->read->prev) { ++#endif + ngx_delete_posted_event(c->read); + } + +@@ -3261,7 +3265,11 @@ ngx_http_lua_socket_tcp_finalize_write_part(ngx_http_request_t *r, + ngx_del_event(c->write, NGX_WRITE_EVENT, NGX_CLOSE_EVENT); + } + ++#if defined(nginx_version) && nginx_version >= 1007005 ++ if (c->write->posted) { ++#else + if (c->write->prev) { ++#endif + ngx_delete_posted_event(c->write); + } + diff --git a/www-servers/nginx/files/nginx-1.4.1-fix-perl-install-path.patch b/www-servers/nginx/files/nginx-1.4.1-fix-perl-install-path.patch new file mode 100644 index 000000000000..601a79ba8a0f --- /dev/null +++ b/www-servers/nginx/files/nginx-1.4.1-fix-perl-install-path.patch @@ -0,0 +1,13 @@ +diff --git a/auto/lib/perl/make b/auto/lib/perl/make +index 260bd95..857ece6 100644 +--- a/auto/lib/perl/make ++++ b/auto/lib/perl/make +@@ -35,6 +35,8 @@ $NGX_OBJS/src/http/modules/perl/Makefile: \\ + NGX_DEPS="\$(CORE_DEPS) \$(HTTP_DEPS)" \\ + $NGX_PERL Makefile.PL \\ + LIB=$NGX_PERL_MODULES \\ ++ PREFIX=$NGX_PREFIX \\ ++ INSTALLDIRS=vendor \\ + INSTALLSITEMAN3DIR=$NGX_PERL_MODULES_MAN + + END diff --git a/www-servers/nginx/files/nginx.conf b/www-servers/nginx/files/nginx.conf new file mode 100644 index 000000000000..74c015f708ca --- /dev/null +++ b/www-servers/nginx/files/nginx.conf @@ -0,0 +1,72 @@ +user nginx nginx; +worker_processes 1; + +error_log /var/log/nginx/error_log info; + +events { + worker_connections 1024; + use epoll; +} + +http { + include /etc/nginx/mime.types; + default_type application/octet-stream; + + log_format main + '$remote_addr - $remote_user [$time_local] ' + '"$request" $status $bytes_sent ' + '"$http_referer" "$http_user_agent" ' + '"$gzip_ratio"'; + + client_header_timeout 10m; + client_body_timeout 10m; + send_timeout 10m; + + connection_pool_size 256; + client_header_buffer_size 1k; + large_client_header_buffers 4 2k; + request_pool_size 4k; + + gzip on; + gzip_min_length 1100; + gzip_buffers 4 8k; + gzip_types text/plain; + + output_buffers 1 32k; + postpone_output 1460; + + sendfile on; + tcp_nopush on; + tcp_nodelay on; + + keepalive_timeout 75 20; + + ignore_invalid_headers on; + + index index.html; + + server { + listen 127.0.0.1; + server_name localhost; + + access_log /var/log/nginx/localhost.access_log main; + error_log /var/log/nginx/localhost.error_log info; + + root /var/www/localhost/htdocs; + } + + # SSL example + #server { + # listen 127.0.0.1:443; + # server_name localhost; + + # ssl on; + # ssl_certificate /etc/ssl/nginx/nginx.pem; + # ssl_certificate_key /etc/ssl/nginx/nginx.key; + + # access_log /var/log/nginx/localhost.ssl_access_log main; + # error_log /var/log/nginx/localhost.ssl_error_log info; + + # root /var/www/localhost/htdocs; + #} +} diff --git a/www-servers/nginx/files/nginx.initd-r2 b/www-servers/nginx/files/nginx.initd-r2 new file mode 100644 index 000000000000..54605c4b86e3 --- /dev/null +++ b/www-servers/nginx/files/nginx.initd-r2 @@ -0,0 +1,89 @@ +#!/sbin/runscript +# Copyright 1999-2013 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Id$ + +extra_commands="configtest" +extra_started_commands="upgrade reload" + +description="Robust, small and high performance http and reverse proxy server" +description_configtest="Run nginx' internal config check." +description_upgrade="Upgrade the nginx binary without losing connections." +description_reload="Reload the nginx configuration without losing connections." + +nginx_config=${nginx_config:-/etc/nginx/nginx.conf} + +command="/usr/sbin/nginx" +command_args="-c ${nginx_config}" +pidfile=${pidfile:-/run/nginx.pid} +user=${user:-nginx} +group=${group:-nginx} + +depend() { + need net + use dns logger netmount +} + +start_pre() { + if [ "${RC_CMD}" != "restart" ]; then + configtest || return 1 + fi +} + +stop_pre() { + if [ "${RC_CMD}" = "restart" ]; then + configtest || return 1 + fi +} + +stop_post() { + rm -f ${pidfile} +} + +reload() { + configtest || return 1 + ebegin "Refreshing nginx' configuration" + kill -HUP `cat ${pidfile}` &>/dev/null + eend $? "Failed to reload nginx" +} + +upgrade() { + configtest || return 1 + ebegin "Upgrading nginx" + + einfo "Sending USR2 to old binary" + kill -USR2 `cat ${pidfile}` &>/dev/null + + einfo "Sleeping 3 seconds before pid-files checking" + sleep 3 + + if [ ! -f ${pidfile}.oldbin ]; then + eerror "File with old pid not found" + return 1 + fi + + if [ ! -f ${pidfile} ]; then + eerror "New binary failed to start" + return 1 + fi + + einfo "Sleeping 3 seconds before WINCH" + sleep 3 ; kill -WINCH `cat ${pidfile}.oldbin` + + einfo "Sending QUIT to old binary" + kill -QUIT `cat ${pidfile}.oldbin` + + einfo "Upgrade completed" + eend $? "Upgrade failed" +} + +configtest() { + ebegin "Checking nginx' configuration" + ${command} -c ${nginx_config} -t -q + + if [ $? -ne 0 ]; then + ${command} -c ${nginx_config} -t + fi + + eend $? "failed, please correct errors above" +} diff --git a/www-servers/nginx/files/nginx.logrotate-r1 b/www-servers/nginx/files/nginx.logrotate-r1 new file mode 100644 index 000000000000..a78ed7a1a79c --- /dev/null +++ b/www-servers/nginx/files/nginx.logrotate-r1 @@ -0,0 +1,12 @@ +# Copyright 1999-2014 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Id$ + +/var/log/nginx/*_log { + missingok + delaycompress + sharedscripts + postrotate + test -r /run/nginx.pid && kill -USR1 `cat /run/nginx.pid` + endscript +} diff --git a/www-servers/nginx/files/nginx.service-r1 b/www-servers/nginx/files/nginx.service-r1 new file mode 100644 index 000000000000..797c7edffafa --- /dev/null +++ b/www-servers/nginx/files/nginx.service-r1 @@ -0,0 +1,14 @@ +[Unit] +Description=The nginx HTTP and reverse proxy server +After=network.target remote-fs.target nss-lookup.target + +[Service] +Type=forking +PIDFile=/run/nginx.pid +ExecStartPre=/usr/sbin/nginx -t +ExecStart=/usr/sbin/nginx +ExecReload=/bin/kill -HUP $MAINPID +ExecStop=/bin/kill -QUIT $MAINPID + +[Install] +WantedBy=multi-user.target diff --git a/www-servers/nginx/files/rtmp-nginx-1.7.6.patch b/www-servers/nginx/files/rtmp-nginx-1.7.6.patch new file mode 100644 index 000000000000..ae8ccce8cb39 --- /dev/null +++ b/www-servers/nginx/files/rtmp-nginx-1.7.6.patch @@ -0,0 +1,89 @@ +From dd5f2aa117c617e1f0fde26f8fd58903be2d85e8 Mon Sep 17 00:00:00 2001 +From: Roman Arutyunyan <arut@qip.ru> +Date: Wed, 17 Sep 2014 07:10:38 +0400 +Subject: [PATCH] fixed compilation + +--- + ngx_rtmp.c | 4 ++++ + ngx_rtmp.h | 9 +++++++++ + ngx_rtmp_play_module.c | 8 +++++++- + 3 files changed, 20 insertions(+), 1 deletion(-) + +diff --git a/ngx_rtmp.c b/ngx_rtmp.c +index c079c90..e525a93 100644 +--- a/ngx_rtmp.c ++++ b/ngx_rtmp.c +@@ -31,7 +31,11 @@ static char * ngx_rtmp_merge_applications(ngx_conf_t *cf, + ngx_uint_t ctx_index); + + ++#if (nginx_version >= 1007005) ++ngx_thread_volatile ngx_queue_t ngx_rtmp_init_queue; ++#else + ngx_thread_volatile ngx_event_t *ngx_rtmp_init_queue; ++#endif + + + ngx_uint_t ngx_rtmp_max_module; +diff --git a/ngx_rtmp.h b/ngx_rtmp.h +index d3648f7..b87e99e 100644 +--- a/ngx_rtmp.h ++++ b/ngx_rtmp.h +@@ -12,6 +12,7 @@ + #include <ngx_core.h> + #include <ngx_event.h> + #include <ngx_event_connect.h> ++#include <nginx.h> + + #include "ngx_rtmp_amf.h" + #include "ngx_rtmp_bandwidth.h" +@@ -198,7 +199,11 @@ typedef struct { + ngx_str_t *addr_text; + int connected; + ++#if (nginx_version >= 1007005) ++ ngx_queue_t posted_dry_events; ++#else + ngx_event_t *posted_dry_events; ++#endif + + /* client buffer time in msec */ + uint32_t buflen; +@@ -602,7 +607,11 @@ extern ngx_rtmp_bandwidth_t ngx_rtmp_bw_in; + + + extern ngx_uint_t ngx_rtmp_naccepted; ++#if (nginx_version >= 1007005) ++extern ngx_thread_volatile ngx_queue_t ngx_rtmp_init_queue; ++#else + extern ngx_thread_volatile ngx_event_t *ngx_rtmp_init_queue; ++#endif + + extern ngx_uint_t ngx_rtmp_max_module; + extern ngx_module_t ngx_rtmp_core_module; +diff --git a/ngx_rtmp_play_module.c b/ngx_rtmp_play_module.c +index acaa46c..f6ea6c3 100644 +--- a/ngx_rtmp_play_module.c ++++ b/ngx_rtmp_play_module.c +@@ -6,6 +6,7 @@ + + #include <ngx_config.h> + #include <ngx_core.h> ++#include <nginx.h> + #include "ngx_rtmp_play_module.h" + #include "ngx_rtmp_cmd_module.h" + #include "ngx_rtmp_netcall_module.h" +@@ -430,7 +431,12 @@ ngx_rtmp_play_do_stop(ngx_rtmp_session_t *s) + ngx_del_timer(&ctx->send_evt); + } + +- if (ctx->send_evt.prev) { ++#if (nginx_version >= 1007005) ++ if (ctx->send_evt.posted) ++#else ++ if (ctx->send_evt.prev) ++#endif ++ { + ngx_delete_posted_event((&ctx->send_evt)); + } + |