Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 533570
Collapse All | Expand All

(-)a/www-servers/nginx/Manifest (+31 lines)
Line 0 Link Here
1
AUX check_1.7.2+.patch 6822 SHA256 e90d8d25d35c2315e3008c60954c4e57aed48d1eb9cab91466356d4967bc46ae SHA512 2857b3e2ae058601e7a1af9b6e7f41e01d4c47ec442df89c3dc407cf9fb6867ab126081547cf9336ccdc40a2a15ea8ab3ed024376d9fbb628432fa3057064440 WHIRLPOOL a96e88f5ff0e3a22745b662c79ed6c15e42ebe121e74f294f17f767e18f77dbecc6c6c105ea13c47d2a298a504115bbd1c9bed4189de2677485fd0eda5108ec8
2
AUX lua-nginx-1.7.6.patch 1362 SHA256 02e8eca7895831ef34690286338509f652d4376ef0d7b93bcf2e794e2e20de48 SHA512 ebe40dbc7ad6983d91243e30bda5b87e2b947ff5c94db2287ee75c281cc95f567f3140abd6099cbfd2f0454e1eb71423e464ff8c4931148379812512aaa168d5 WHIRLPOOL 5e07e50bddaaeb4213104ff89b95a1a07096daeed910edb8e729783daa650b591ca963c79b1a88007f216c51c8b44fc6e52a70877aa3d1beeff36682e327e293
3
AUX nginx-1.4.1-fix-perl-install-path.patch 403 SHA256 0f10cf594208d99942cd07b13799bdd62ad9dc62479b302c0390de381c7fdf28 SHA512 b8f6876831e1149b1421fff4919f8d4893e5fc46aad8a91d4cf2e0b21767b59820b8e227e3b722b80060832844ef191f30aa5dc056daeb49e55a05702d72858f WHIRLPOOL a29dc1b707695ad29b5e967c545b6059120ce9d1a95b828062f6507d8ccd730c95fc82843564baa51d644e138d40fc93b0a84c916a4d77a51c1495625a103809
4
AUX nginx-1.7.8-fix-musl-crypt.patch 288 SHA256 fa7b385e9a304db12a90a94adcaf4b82e94ad4899c2163a40529a50f97fffc6a SHA512 b9fb37c82ea1bf7971bd40f0a55cb17aa5c6adf503b120154ac3f37d54f5d13a69e61c73d55c14cd8d81f2eec592d589e030b2fdb6a7af755ad5a15314b91eaf WHIRLPOOL 76964e3780c41053cb4017d8f5fa7ab7b59771a4a82c10ae50cf026c4a2fffe8c3bf1b70d6698a1f16887a538cbdc22a22aff6145a38f8ceb281f7bd49fc7c67
5
AUX nginx.conf 1358 SHA256 6ff6c9301ea2a4d74a335b9119d7f9dba87d4e83793cf22d837d49f061763096 SHA512 1873c9e54ea5020160c86da3f300e3eac589c0d30cdbe3446476b5b3f5bd388da95224cfb1a020b41720c9ce55ab6bb945dcc41612d5850da0e2ae0ceeeaa587 WHIRLPOOL 7672245bd11d6ed987e13d6bfe4dbc2140cc3d2e22616c49ab7ed5f42135c96b5779e4dfd16ba9e2d82aa59d98cd56a4872d18c3774e357ef79385fc874387d2
6
AUX nginx.initd-r2 2005 SHA256 9d5fca09d0161446a5cec30a0694cdc0656469403a008920a52a190051218b36 SHA512 871f5e05d3a5e496708b49863917bc8fa163c7ca974261aaacdf2e9c4aa923582889da92bd23e0129915a1467efdd9befc9a6e50f9eb1d173cd1ec05508c6c1b WHIRLPOOL 4468188d830bd2d1587b3ae857640bb07e48e9d5d2b51b3ce1e6a11da62ccf226025c4e8d78e0b69b253aa9c5a663ea02b95980715a32c464fd4c74dd5656b96
7
AUX nginx.logrotate-r1 376 SHA256 3de8e7c155202760ce381e4cc08052195a51e267ab7f9563fe20be00fbc3c21a SHA512 24684a94ea5f897079626ea1c60ef518bf04c234cfa7116a0dc0334d3f19fe3ada47661aa1d7bd07216dda3d20413147921c98fa5d9794ba2da6affbbd8c4cbf WHIRLPOOL a31f401e4fb5804332f8a7daf4d50f0dc4a086cb4e75dc0e81fe9a328bb05fa38fef429270e81b256719a0bf7b849a0ccd8a05817e39bad26a40ee5823a0dcfc
8
AUX nginx.service-r1 327 SHA256 17c404c5130115e3ebadb09e25cff0103b48ae7dbff2284fa690161fda7888ae SHA512 9b6bcf74df2f74ae6a2c255ebf2d826ea92ed9921b9995da6c9a0c5656e2863a2fe5293ef8a656fbd36298602cc88ffc5d7acfbbf143c23a78c9689d61b05df9 WHIRLPOOL 126c56732b8bd9948595727aa8c056c44df05f4c8e708b00c9de715a7260e4e120fd9e076672312b55c889ff4a3ca100ce696165a4eaf93d89e808e1e28653fa
9
AUX rtmp-nginx-1.7.6.patch 2507 SHA256 c5b6a884e7f097bcb405fdc2011e39ea699f50f8e51a2c3daab2e40dd86fe524 SHA512 ee3c3e91ad88aa245d7563fea537585a493718c1e770c23919118bfb6306a076b82356406af512e79a162aab09fc72fd73af1e2918b9fd9cb06c47df5a798aa8 WHIRLPOOL 0c655c186d4832426628277c99869715d46e2f0909e7ea74a000cd36fcb398e7571afb81287540d1e0fe544f09197f71c0ae143f9ca169329f936b8359bc645a
10
DIST modsecurity-apache_2.8.0.tar.gz 3940435 SHA256 95de6ec30982e5bde7981929ba89be89488e9f237ee8c4236e064b074bbb6f28 SHA512 2620d9ee0c7e40e02b908af5be916d1588f2ba55b8718495b6a3654e868973c45e8f8e794bf28b4677eb8a2d96ba427ead6ae4b26e48014bcd2b2f02013ceeef WHIRLPOOL cd90488ca5a85292bae32685ce44bcb82f46d98194636ba68f47a860c648c6933766bd56a38143f7656725fb3bd359de17f1b5513447c6ee40dbad945559fe4d
11
DIST nginx-1.7.8.tar.gz 823122 SHA256 12f75ec302d3d3b841408e59bbf5116d38527b8c679abfcba7ceb866be60e8e5 SHA512 54833ad6d0ed6bda15d805d171abe980177c0a6d0651dd995d4bbb3d76b6ac77f7fe83d036716cab25c71d61477790967e6e5dcd8bbfdaa98c7e3baa5512323d WHIRLPOOL 2fec99391b394941ae1ffad34acefda3a94047ab509668b4eee99c62be3e1179a382206d90a714c107280e9f600493c1aad8bba73d868d136bee55d569316630
12
DIST nginx_http_sticky_module_ng-1.2.5.tar.bz2 124072 SHA256 f975c033eb3c342f7247f6524774bbb727aaf630ed984576dbafe5de7a790c58 SHA512 d6ae723f739efb2f0548461931b1c395801684759962beda08067111426b1c9787ceaede91b0e984c023108fd17864c53c53925506f7e8e25ec8d2fc065585f6 WHIRLPOOL 1013c6a51f5989c8131392b3d9704d42c99f9727a673f6205878d0b7dfd265bb6042c1d30089603c9b38e339d48302e6873e77fe380b7e8edba25b71e9e84ba6
13
DIST ngx_devel_kit-0.2.19-r1.tar.gz 65029 SHA256 501f299abdb81b992a980bda182e5de5a4b2b3e275fbf72ee34dd7ae84c4b679 SHA512 915954acf16a27fbd3c93c154012d38e864f1d8dfd51cde401bba26e46eb3e3c778ec4c92f4f8ed83ac001e96cee72765554d0e4da06acf6a4be5184b23b3657 WHIRLPOOL 0ce6bffc0fe2cef28ee74f5862ca6d914ed18fdee18d900608ff2a9983594c707aab3e335957b79dd7e77ae1beed054d8f71965ca0f57fc5f1d41ac06106c5a4
14
DIST ngx_http_ajp_module-0.3.0.tar.gz 108832 SHA256 7b3791275ef87dde153679fa459e84784da09b26d35426d61f5477903584b254 SHA512 0934ea3c7dce23e2c55ab5c9210562fcf7b38ef19dc9ca7b80daee3cd983bb5f69743d34a041d35e7089dd6f6aa73363014d0b5f04ce0a5c0d94b4b0bb2dacab WHIRLPOOL 2ebe0db7887f22fb915372ef637214a0a40d7a0b694479b7da066671bd7c64aa152c5a615f368916311f5879840e083fb7a14555d304aea5e059c079aaa9c809
15
DIST ngx_http_auth_pam-1.3.tar.gz 6363 SHA256 199dff5d11fbb3b6ddf9c8a60cc141970125a3f8e7a06f245e3175e93ca947e3 SHA512 3c86f709397dfd3edbd98f729193cb7b61895777d02244f1cf255ba5e4cd8e7bcb5bf537bf3d1086a513e46f117fdcb7610d7085dead35f5d36f74b5b3864ef8 WHIRLPOOL fc5b42a6a1143e9d3845e1470caa7bd60cf8e5a01e0dd53925fbf76cba072add024d24e4f926d3d0b3e27eccf5faa839b05f2549144beac6ffc43614b7ca5b19
16
DIST ngx_http_cache_purge-2.2.tar.gz 11034 SHA256 167c04ceaac87e3adafce9c44e4ef9b74a03172bd35ebc216cb07ff2dc301bae SHA512 02f8f6ebc47886e49836e90fad1f76920d14c64824c91f392b175fe9eddb77a07c4d2689c8e98c62f3ec0f9754211f00cf9810cfa29edd429db649fd1de8db53 WHIRLPOOL 9f65823ae70c7fc0ef6c113026e92dce394290517a5a1e58fb0e51f8fe4d7af1333f57df73aad7f051e29379bd663113c52fc13459ae15a8321f8f0f2b850315
17
DIST ngx_http_dav_ext-0.0.3.tar.gz 6260 SHA256 d428a0236c933779cb40ac8c91afb19d5c25a376dc3caab825bfd543e1ee530d SHA512 4763b1c5e417248d80acfacf20bfc5ba3e06675ff08e37703867daef99a400980b536941e4955c259432905bd11ab998bc2e2489a50350413c7bf37e18eafb74 WHIRLPOOL 5adbcea768fbb179249a03fe69304505ec09a1dafac848dd5e3cde96693c6fbcf6cf6c128ca116d02b36c1be0008807d9e86fee5b411e137b18b15a60291f29b
18
DIST ngx_http_echo-0.57.tar.gz 65073 SHA256 8467237ca0fae74ca7a32fbd34fc6044df307098415d48068214c9c235695a07 SHA512 c89780eca9267c9984a022a4dbd9ebf603dbd5c323bfea5ea7898ca9fc0a744388ce7520e7a9799aeabd6573f8e71ee595fe9998fa54e5d5c412b21031edd31d WHIRLPOOL e481b6f57a6ff48706fa7e281f31f15a5522c29b98620559cebe8412207d5595497cdce9156e7762cceff6369e9f678d5a81bf3c83fb2e8c5d8786622f1c27b8
19
DIST ngx_http_fancyindex-0.3.4.tar.gz 14275 SHA256 d7a84e66b3b3571e6a7e2531d00767f4354f85ce2f281d532ace2bcc35035f8b SHA512 a8a78f83f34c910e0959b04f45ba897f0c84f2a3f36d1c36cd32a8e2a5d9e53f2d0f30cf6a99ffd76edc6179cb70561984745943ec05cca10bdda7ed29c8bfe4 WHIRLPOOL eaafe4a95eed6f43efed354978040c0856ca5819ed0b141637aee0b1c0aafcf2cc205b130f0ca4de39b224dbfb7083c158a4388768fa2515890e227a43245474
20
DIST ngx_http_headers_more-0.25-r1.tar.gz 27973 SHA256 1473f96f59dcec9d83ce65d691559993c1f80da8c0a4c0c0a30dae9f969eeabf SHA512 1a03e72ac5847b0eeada0ba1e5d5872399dd636db6aa54d10c9e53d96f4b5be4c785bf9117991d27ed558532fe9ce95d6f6c63f94f5b83350f5ea14a60c03aaf WHIRLPOOL 03a7e21814a05644bd1a459bc7b0b26dee0d4ec6ae81f4677f631fa1e4c52c679b651341d673319c6469adcf0ad8e29db58065f542e5907729a609edb6e633f4
21
DIST ngx_http_lua-0.9.13.tar.gz 516077 SHA256 fb327bc4af649b70e588bef34478f18f5907be51c9fff4a233ac4100c5a70177 SHA512 1340a50e1b23845e1bcbb997c0e60e70a73552856151d16f97ae56683eff4870468ae9a3c8f3ddc475fd074e640fb5f2e2f4ce7f5711960ffdd6a8fc1a1829d5 WHIRLPOOL 4c02ffcd6f56426f34f152cbf1354b0e668cdde77c1136be95e28454ee316d73f856723c132dfc2cb95d715daee9b887dfe97fe1564f7f20a191349f5df00777
22
DIST ngx_http_naxsi-0.53-2.tar.gz 165690 SHA256 3eadff1d91995beae41b92733ade28091c2075a24ae37058f4d6aa90b0f4b660 SHA512 ada592f5e7f80a6d549cc435ee8720df01a788dc88cf27a7d55521bb7e4c66fa11b9ec28216aff7e13c70a5faf12cb745bd398b8a782ed4dea1eecd04b07e24c WHIRLPOOL c5b736dbe9bd66daf7e023f176a08f78225b61990781d7ad5a55d0f35391df7e05bf1b2623a6227e0355cf0204ef9eac1b9fa03aa62b3c0d6eac515f1213f270
23
DIST ngx_http_push_stream-0.4.1.tar.gz 166928 SHA256 553584f557a3faec73702550e7e1417cbc0021f4f98468cc83e61e9d94def5cc SHA512 3b2289cc3abe6df0ee39360816675a39de1669a284e23770aa04b29e1e5dc73f5d99f3db6c7e8e4895a4abad0602aa64024ec19a2e741e138a70191501f038be WHIRLPOOL 9d203d4a78a3bd189527ebeaf1ff98613ee6a3150ae433efa17ed45dd9f6cb263b2a4c329a6fc2d04c6583ac2beaf24e87e3263d71a910f720b80038c9bc09c2
24
DIST ngx_http_slowfs_cache-1.10.tar.gz 11809 SHA256 1e81453942e5b0877de1f1f06c56ae82918ea9818255cb935bcb673c95a758a1 SHA512 fbc9609a8d6913aeefe535f206b9e53477503f131934ead2ae5a6169e395af2f5fb54778704824d5eeb22a4ef40a11ebbcde580db62a631f70edcc2cfc06b15d WHIRLPOOL a02ed77422c47d9e476f8746186d19d632ddb953635d8d9dd51ff076225a78044286ee7e114478bc02e4b2a422e4fdc207154fc287629dd2cd7c3f9a634dad18
25
DIST ngx_http_upload_progress-0.9.1-r1.tar.gz 17166 SHA256 99ec072cca35cd7791e77c40a8ded41a7a8c1111e057be26e55fba2fdf105f43 SHA512 6c1e3776402b6e2cda50d9c48c4b578a85feffe15891c075443f6d9c7b9e2414e0614b50a8f417ddda9faf5f719957c77ade519c88b48caec970fc51fe12f0d1 WHIRLPOOL 12970d0f75ee3f0d8a97c4948b97fca2bd707a93e4e578c0e2ac0d18991986e620dd6b15c2ab5680ff726c0490671e3bc5e1ee6109baf81877d8baa6a5357825
26
DIST ngx_http_upstream_check-0.3.0.tar.gz 136542 SHA256 c543bf427b38643c10dcd1a0c701392bc666708313e7b63f9272396a6cc9a461 SHA512 ca19e8bcae218c639ff59e8f743bd2fb78de2c1f33dfb0de7b7b5ce82ae7ef04488255715e3e0311ebbc8c9741726573ac532cb269052925b0935f349414e959 WHIRLPOOL acee2ea955f87844a724815fc78d0296f23e9d6726551febd6bbff563625e8eadd04213394b6029c45b6036138c4f8957b2621f1b033a6177410fa7778176749
27
DIST ngx_metrics-0.1.1.tar.gz 2964 SHA256 1c62ebb31e3caafad91720962770b0e7a4287f195520cf12471c262ac19b154e SHA512 d36a8fb0104c83b6b564e03b351aa750cab08650264c74d6f786af357bfb7006b531a93270dd961896ea8dafe27e5db8548ede714c5f52c4742876bc73af4b5e WHIRLPOOL 2796f5a97e76dfcc91133240e8e90ba493f0356f781a173d8cacdd09eba64b75ef531db398c0566fda395124700de8c991b771433e376ca0d5898c2ea6f82868
28
DIST ngx_mogilefs_module-1.0.4.tar.gz 11208 SHA256 7ac230d30907f013dff8d435a118619ea6168aa3714dba62c6962d350c6295ae SHA512 b8cb7eaf6274f4e2247dbcb39db05072d2b2d4361256a325fafab5533d7ce0c4ae9e2905b954dfcfa4789c9cab5cccf2ac1c3a1f02f6a327ed95b562d7773ed1 WHIRLPOOL 64c9b11ad938e6dbe5ba31298f1cd46f6e6bb4ba039c96b1e43bd85919d1606326f74b677f789ecabe0b0f4e0f08ac5aaf8148bf820de65aaa1e9966a28b9f61
29
DIST ngx_rtmp-1.1.6.tar.gz 519666 SHA256 4039d1e7febd93188f729b594772d04d8a1137b2e90b12fa53bb061f200add87 SHA512 6db0cc5a3cff600a836483f9cc4ff76860e9c893167561ad818cb41e2eb4fa31af8a4213e42c7c5766e389aed0ad713cffe776aa4bc4ebf279dd63eb65d4162c WHIRLPOOL f23860df6df0de87aa7d65f2411ea7104e635e5b13987853599a06c064b93229c8a900dca84b983e0dcabac96c8918889932cd303836a3cab4ac7c6d7c2a0b10
30
EBUILD nginx-1.7.8-r99.ebuild 25355 SHA256 7912a251029df06718e83a64485c4ffeecd3e274fbde1be0433c63ab9ed09801 SHA512 1107fa2b9fc9cfebb10786555b4e1855a7bf59b21b4340de7047f686218da24f2b05c513f5a3aed4e37b0810ea01cc2e81e09e5851cbdab297a852254d1e0ee5 WHIRLPOOL cd7bfff3b26b6a590e7141e2c55371a266d5f2ad0d715a7e8df2b298483d3860b98a8d0699524c896680e51c59702b637b55084303b68caab862b5c8c4be635d
31
MISC metadata.xml 1126 SHA256 0fe0200ad601a444f2afad4a35ec60c40a595ce777b0cce52e5f0f8aaca05dc3 SHA512 3113e4ff1a185f4f9de6752a363dc12a0de47e18acef9fed26333b1c548f00c850e94bab5a3d6fa7ecdced4cb265d3bd27dafd8aa6846911d6e8f120198c071f WHIRLPOOL 7f99d1a112af86d08210b3ab13b95939918a4671c64f534a54bb441164391cecedc809d69ec88a44068618da096c5d91c9cfac4fd3da6cbb3221d83153b191b7
(-)a/www-servers/nginx/files/check_1.7.2+.patch (+201 lines)
Line 0 Link Here
1
commit 21116e1c0bba730ca59327ffba9320bc63f11462
2
Author: Johan Bergström <bugs@bergstroem.nu>
3
Date:   Thu Jun 19 10:17:22 2014 +1000
4
5
    Add support for upstream_check to nginx 1.7.2
6
7
diff --git src/http/modules/ngx_http_upstream_ip_hash_module.c src/http/modules/ngx_http_upstream_ip_hash_module.c
8
index 148d73a..be9e03d 100644
9
--- src/http/modules/ngx_http_upstream_ip_hash_module.c
10
+++ src/http/modules/ngx_http_upstream_ip_hash_module.c
11
@@ -9,6 +9,9 @@
12
 #include <ngx_core.h>
13
 #include <ngx_http.h>
14
 
15
+#if (NGX_UPSTREAM_CHECK_MODULE)
16
+#include "ngx_http_upstream_check_handler.h"
17
+#endif
18
 
19
 typedef struct {
20
     /* the round robin data must be first */
21
@@ -212,6 +215,15 @@ ngx_http_upstream_get_ip_hash_peer(ngx_peer_connection_t *pc, void *data)
22
             goto next_try;
23
         }
24
 
25
+#if (NGX_UPSTREAM_CHECK_MODULE)
26
+        ngx_log_debug1(NGX_LOG_DEBUG_HTTP, pc->log, 0,
27
+            "get ip_hash peer, check_index: %ui",
28
+             peer->check_index);
29
+        if (ngx_http_check_peer_down(peer->check_index)) {
30
+            goto next_try;
31
+        }
32
+#endif
33
+
34
         if (peer->max_fails
35
             && peer->fails >= peer->max_fails
36
             && now - peer->checked <= peer->fail_timeout)
37
diff --git src/http/modules/ngx_http_upstream_least_conn_module.c src/http/modules/ngx_http_upstream_least_conn_module.c
38
index dbef95d..14e9e40 100644
39
--- src/http/modules/ngx_http_upstream_least_conn_module.c
40
+++ src/http/modules/ngx_http_upstream_least_conn_module.c
41
@@ -9,6 +9,9 @@
42
 #include <ngx_core.h>
43
 #include <ngx_http.h>
44
 
45
+#if (NGX_UPSTREAM_CHECK_MODULE)
46
+#include "ngx_http_upstream_check_handler.h"
47
+#endif
48
 
49
 typedef struct {
50
     ngx_uint_t                        *conns;
51
@@ -203,6 +206,16 @@ ngx_http_upstream_get_least_conn_peer(ngx_peer_connection_t *pc, void *data)
52
             continue;
53
         }
54
 
55
+#if (NGX_UPSTREAM_CHECK_MODULE)
56
+        ngx_log_debug1(NGX_LOG_DEBUG_HTTP, pc->log, 0,
57
+                "get least_conn peer, check_index: %ui",
58
+                peer->check_index);
59
+
60
+        if (ngx_http_check_peer_down(peer->check_index)) {
61
+            continue;
62
+        }
63
+#endif
64
+
65
         if (peer->max_fails
66
             && peer->fails >= peer->max_fails
67
             && now - peer->checked <= peer->fail_timeout)
68
@@ -256,6 +269,16 @@ ngx_http_upstream_get_least_conn_peer(ngx_peer_connection_t *pc, void *data)
69
                 continue;
70
             }
71
 
72
+#if (NGX_UPSTREAM_CHECK_MODULE)
73
+            ngx_log_debug1(NGX_LOG_DEBUG_HTTP, pc->log, 0,
74
+                    "get least_conn peer, check_index: %ui",
75
+                    peer->check_index);
76
+
77
+            if (ngx_http_check_peer_down(peer->check_index)) {
78
+                continue;
79
+            }
80
+#endif
81
+
82
             if (lcp->conns[i] * best->weight != lcp->conns[p] * peer->weight) {
83
                 continue;
84
             }
85
diff --git src/http/ngx_http_upstream_round_robin.c src/http/ngx_http_upstream_round_robin.c
86
index 37c835c..43ccdcf 100644
87
--- src/http/ngx_http_upstream_round_robin.c
88
+++ src/http/ngx_http_upstream_round_robin.c
89
@@ -9,6 +9,9 @@
90
 #include <ngx_core.h>
91
 #include <ngx_http.h>
92
 
93
+#if (NGX_UPSTREAM_CHECK_MODULE)
94
+#include "ngx_http_upstream_check_handler.h"
95
+#endif
96
 
97
 static ngx_http_upstream_rr_peer_t *ngx_http_upstream_get_peer(
98
     ngx_http_upstream_rr_peer_data_t *rrp);
99
@@ -88,6 +91,14 @@ ngx_http_upstream_init_round_robin(ngx_conf_t *cf,
100
                 peer[n].fail_timeout = server[i].fail_timeout;
101
                 peer[n].down = server[i].down;
102
                 peer[n].server = server[i].name;
103
+#if (NGX_UPSTREAM_CHECK_MODULE)
104
+                if (!server[i].down) {
105
+                    peers->peer[n].check_index =
106
+                        ngx_http_check_add_peer(cf, us, &server[i].addrs[j]);
107
+                } else {
108
+                    peers->peer[n].check_index = (ngx_uint_t) NGX_ERROR;
109
+                }
110
+#endif
111
                 n++;
112
             }
113
         }
114
@@ -144,6 +155,15 @@ ngx_http_upstream_init_round_robin(ngx_conf_t *cf,
115
                 peer[n].fail_timeout = server[i].fail_timeout;
116
                 peer[n].down = server[i].down;
117
                 peer[n].server = server[i].name;
118
+#if (NGX_UPSTREAM_CHECK_MODULE)
119
+                if (!server[i].down) {
120
+                    backup->peer[n].check_index =
121
+                        ngx_http_check_add_peer(cf, us, &server[i].addrs[j]);
122
+                }
123
+                else {
124
+                    backup->peer[n].check_index = (ngx_uint_t) NGX_ERROR;
125
+                }
126
+#endif
127
                 n++;
128
             }
129
         }
130
@@ -203,6 +223,9 @@ ngx_http_upstream_init_round_robin(ngx_conf_t *cf,
131
         peer[i].current_weight = 0;
132
         peer[i].max_fails = 1;
133
         peer[i].fail_timeout = 10;
134
+#if (NGX_UPSTREAM_CHECK_MODULE)
135
+        peers->peer[i].check_index = (ngx_uint_t) NGX_ERROR;
136
+#endif
137
     }
138
 
139
     us->peer.data = peers;
140
@@ -312,7 +335,9 @@ ngx_http_upstream_create_round_robin_peer(ngx_http_request_t *r,
141
         peer[0].current_weight = 0;
142
         peer[0].max_fails = 1;
143
         peer[0].fail_timeout = 10;
144
-
145
+#if (NGX_UPSTREAM_CHECK_MODULE)
146
+        peers->peer[0].check_index = (ngx_uint_t) NGX_ERROR;
147
+#endif
148
     } else {
149
 
150
         for (i = 0; i < ur->naddrs; i++) {
151
@@ -352,6 +377,9 @@ ngx_http_upstream_create_round_robin_peer(ngx_http_request_t *r,
152
             peer[i].current_weight = 0;
153
             peer[i].max_fails = 1;
154
             peer[i].fail_timeout = 10;
155
+#if (NGX_UPSTREAM_CHECK_MODULE)
156
+            peers->peer[i].check_index = (ngx_uint_t) NGX_ERROR;
157
+#endif
158
         }
159
     }
160
 
161
@@ -411,6 +439,12 @@ ngx_http_upstream_get_round_robin_peer(ngx_peer_connection_t *pc, void *data)
162
             goto failed;
163
         }
164
 
165
+#if (NGX_UPSTREAM_CHECK_MODULE)
166
+        if (ngx_http_check_peer_down(peer->check_index)) {
167
+            goto failed;
168
+        }
169
+#endif
170
+
171
     } else {
172
 
173
         /* there are several peers */
174
@@ -508,6 +542,12 @@ ngx_http_upstream_get_peer(ngx_http_upstream_rr_peer_data_t *rrp)
175
             continue;
176
         }
177
 
178
+#if (NGX_UPSTREAM_CHECK_MODULE)
179
+        if (ngx_http_check_peer_down(peer->check_index)) {
180
+            continue;
181
+        }
182
+#endif
183
+
184
         if (peer->max_fails
185
             && peer->fails >= peer->max_fails
186
             && now - peer->checked <= peer->fail_timeout)
187
diff --git src/http/ngx_http_upstream_round_robin.h src/http/ngx_http_upstream_round_robin.h
188
index 9db82a6..2fedd46 100644
189
--- src/http/ngx_http_upstream_round_robin.h
190
+++ src/http/ngx_http_upstream_round_robin.h
191
@@ -31,6 +31,10 @@ typedef struct {
192
     ngx_uint_t                      max_fails;
193
     time_t                          fail_timeout;
194
 
195
+#if (NGX_UPSTREAM_CHECK_MODULE)
196
+    ngx_uint_t                      check_index;
197
+#endif
198
+
199
     ngx_uint_t                      down;          /* unsigned  down:1; */
200
 
201
 #if (NGX_HTTP_SSL)
(-)a/www-servers/nginx/files/lua-nginx-1.7.6.patch (+39 lines)
Line 0 Link Here
1
From 0c4528e50dc45de322a6ae86b1fff544d777e722 Mon Sep 17 00:00:00 2001
2
From: "Yichun Zhang (agentzh)" <agentzh@gmail.com>
3
Date: Wed, 17 Sep 2014 13:18:42 -0700
4
Subject: [PATCH] bugfix: fixed compilation error with nginx 1.7.5+ because
5
 nginx 1.7.5+ changes the API in the events subsystem. thanks Charles R.
6
 Portwood II and Mathieu Le Marec for the report in #422.
7
8
---
9
 src/ngx_http_lua_socket_tcp.c | 8 ++++++++
10
 1 file changed, 8 insertions(+)
11
12
diff --git a/src/ngx_http_lua_socket_tcp.c b/src/ngx_http_lua_socket_tcp.c
13
index 52cc89d..3743548 100644
14
--- a/src/ngx_http_lua_socket_tcp.c
15
+++ b/src/ngx_http_lua_socket_tcp.c
16
@@ -3212,7 +3212,11 @@ ngx_http_lua_socket_tcp_finalize_read_part(ngx_http_request_t *r,
17
             ngx_del_event(c->read, NGX_READ_EVENT, NGX_CLOSE_EVENT);
18
         }
19
 
20
+#if defined(nginx_version) && nginx_version >= 1007005
21
+        if (c->read->posted) {
22
+#else
23
         if (c->read->prev) {
24
+#endif
25
             ngx_delete_posted_event(c->read);
26
         }
27
 
28
@@ -3261,7 +3265,11 @@ ngx_http_lua_socket_tcp_finalize_write_part(ngx_http_request_t *r,
29
             ngx_del_event(c->write, NGX_WRITE_EVENT, NGX_CLOSE_EVENT);
30
         }
31
 
32
+#if defined(nginx_version) && nginx_version >= 1007005
33
+        if (c->write->posted) {
34
+#else
35
         if (c->write->prev) {
36
+#endif
37
             ngx_delete_posted_event(c->write);
38
         }
39
 
(-)a/www-servers/nginx/files/nginx-1.4.1-fix-perl-install-path.patch (+13 lines)
Line 0 Link Here
1
diff --git a/auto/lib/perl/make b/auto/lib/perl/make
2
index 260bd95..857ece6 100644
3
--- a/auto/lib/perl/make
4
+++ b/auto/lib/perl/make
5
@@ -35,6 +35,8 @@ $NGX_OBJS/src/http/modules/perl/Makefile: \\
6
 			NGX_DEPS="\$(CORE_DEPS) \$(HTTP_DEPS)" \\
7
 		$NGX_PERL Makefile.PL \\
8
 			LIB=$NGX_PERL_MODULES \\
9
+			PREFIX=$NGX_PREFIX \\
10
+			INSTALLDIRS=vendor \\
11
 			INSTALLSITEMAN3DIR=$NGX_PERL_MODULES_MAN
12
 
13
 END
(-)a/www-servers/nginx/files/nginx-1.7.8-fix-musl-crypt.patch (+12 lines)
Line 0 Link Here
1
--- a/src/os/unix/ngx_user.c
2
+++ b/src/os/unix/ngx_user.c
3
@@ -31,8 +31,10 @@
4
     struct crypt_data   cd;
5
6
     cd.initialized = 0;
7
+#ifdef __GLIBC__
8
     /* work around the glibc bug */
9
     cd.current_salt[0] = ~salt[0];
10
+#endif
11
12
     value = crypt_r((char *) key, (char *) salt, &cd);
(-)a/www-servers/nginx/files/nginx.conf (+72 lines)
Line 0 Link Here
1
user nginx nginx;
2
worker_processes 1;
3
4
error_log /var/log/nginx/error_log info;
5
6
events {
7
	worker_connections 1024;
8
	use epoll;
9
}
10
11
http {
12
	include /etc/nginx/mime.types;
13
	default_type application/octet-stream;
14
15
	log_format main
16
		'$remote_addr - $remote_user [$time_local] '
17
		'"$request" $status $bytes_sent '
18
		'"$http_referer" "$http_user_agent" '
19
		'"$gzip_ratio"';
20
21
	client_header_timeout 10m;
22
	client_body_timeout 10m;
23
	send_timeout 10m;
24
25
	connection_pool_size 256;
26
	client_header_buffer_size 1k;
27
	large_client_header_buffers 4 2k;
28
	request_pool_size 4k;
29
30
	gzip on;
31
	gzip_min_length 1100;
32
	gzip_buffers 4 8k;
33
	gzip_types text/plain;
34
35
	output_buffers 1 32k;
36
	postpone_output 1460;
37
38
	sendfile on;
39
	tcp_nopush on;
40
	tcp_nodelay on;
41
42
	keepalive_timeout 75 20;
43
44
	ignore_invalid_headers on;
45
46
	index index.html;
47
48
	server {
49
		listen 127.0.0.1;
50
		server_name localhost;
51
52
		access_log /var/log/nginx/localhost.access_log main;
53
		error_log /var/log/nginx/localhost.error_log info;
54
55
		root /var/www/localhost/htdocs;
56
	}
57
58
	# SSL example
59
	#server {
60
	#	listen 127.0.0.1:443;
61
	#	server_name localhost;
62
63
	#	ssl on;
64
	#	ssl_certificate /etc/ssl/nginx/nginx.pem;
65
	#	ssl_certificate_key /etc/ssl/nginx/nginx.key;
66
67
	#	access_log /var/log/nginx/localhost.ssl_access_log main;
68
	#	error_log /var/log/nginx/localhost.ssl_error_log info;
69
70
	#	root /var/www/localhost/htdocs;
71
	#}
72
}
(-)a/www-servers/nginx/files/nginx.initd-r2 (+89 lines)
Line 0 Link Here
1
#!/sbin/runscript
2
# Copyright 1999-2013 Gentoo Foundation
3
# Distributed under the terms of the GNU General Public License v2
4
# $Header: /var/cvsroot/gentoo-x86/www-servers/nginx/files/nginx.initd-r2,v 1.1 2013/05/13 12:18:11 dev-zero Exp $
5
6
extra_commands="configtest"
7
extra_started_commands="upgrade reload"
8
9
description="Robust, small and high performance http and reverse proxy server"
10
description_configtest="Run nginx' internal config check."
11
description_upgrade="Upgrade the nginx binary without losing connections."
12
description_reload="Reload the nginx configuration without losing connections."
13
14
nginx_config=${nginx_config:-/etc/nginx/nginx.conf}
15
16
command="/usr/sbin/nginx"
17
command_args="-c ${nginx_config}"
18
pidfile=${pidfile:-/run/nginx.pid}
19
user=${user:-nginx}
20
group=${group:-nginx}
21
22
depend() {
23
	need net
24
	use dns logger netmount
25
}
26
27
start_pre() {
28
	if [ "${RC_CMD}" != "restart" ]; then
29
		configtest || return 1
30
	fi
31
}
32
33
stop_pre() {
34
	if [ "${RC_CMD}" = "restart" ]; then
35
		configtest || return 1
36
	fi
37
}
38
39
stop_post() {
40
	rm -f ${pidfile}
41
}
42
43
reload() {
44
	configtest || return 1
45
	ebegin "Refreshing nginx' configuration"
46
	kill -HUP `cat ${pidfile}` &>/dev/null
47
	eend $? "Failed to reload nginx"
48
}
49
50
upgrade() {
51
	configtest || return 1
52
	ebegin "Upgrading nginx"
53
54
	einfo "Sending USR2 to old binary"
55
	kill -USR2 `cat ${pidfile}` &>/dev/null
56
57
	einfo "Sleeping 3 seconds before pid-files checking"
58
	sleep 3
59
60
	if [ ! -f ${pidfile}.oldbin ]; then
61
		eerror "File with old pid not found"
62
		return 1
63
	fi
64
65
	if [ ! -f ${pidfile} ]; then
66
		eerror "New binary failed to start"
67
		return 1
68
	fi
69
70
	einfo "Sleeping 3 seconds before WINCH"
71
	sleep 3 ; kill -WINCH `cat ${pidfile}.oldbin`
72
73
	einfo "Sending QUIT to old binary"
74
	kill -QUIT `cat ${pidfile}.oldbin`
75
76
	einfo "Upgrade completed"
77
	eend $? "Upgrade failed"
78
}
79
80
configtest() {
81
	ebegin "Checking nginx' configuration"
82
	${command} -c ${nginx_config} -t -q
83
84
	if [ $? -ne 0 ]; then
85
		${command} -c ${nginx_config} -t
86
	fi
87
88
	eend $? "failed, please correct errors above"
89
}
(-)a/www-servers/nginx/files/nginx.logrotate-r1 (+12 lines)
Line 0 Link Here
1
# Copyright 1999-2014 Gentoo Foundation
2
# Distributed under the terms of the GNU General Public License v2
3
# $Header: /var/cvsroot/gentoo-x86/www-servers/nginx/files/nginx.logrotate-r1,v 1.1 2014/06/19 09:52:24 dev-zero Exp $
4
5
/var/log/nginx/*_log {
6
	missingok
7
	delaycompress
8
	sharedscripts
9
	postrotate
10
		test -r /run/nginx.pid && kill -USR1 `cat /run/nginx.pid`
11
	endscript
12
}
(-)a/www-servers/nginx/files/nginx.service-r1 (+14 lines)
Line 0 Link Here
1
[Unit]
2
Description=The nginx HTTP and reverse proxy server
3
After=network.target remote-fs.target nss-lookup.target
4
5
[Service]
6
Type=forking
7
PIDFile=/run/nginx.pid
8
ExecStartPre=/usr/sbin/nginx -t
9
ExecStart=/usr/sbin/nginx
10
ExecReload=/bin/kill -HUP $MAINPID
11
ExecStop=/bin/kill -QUIT $MAINPID
12
13
[Install]
14
WantedBy=multi-user.target
(-)a/www-servers/nginx/files/rtmp-nginx-1.7.6.patch (+89 lines)
Line 0 Link Here
1
From dd5f2aa117c617e1f0fde26f8fd58903be2d85e8 Mon Sep 17 00:00:00 2001
2
From: Roman Arutyunyan <arut@qip.ru>
3
Date: Wed, 17 Sep 2014 07:10:38 +0400
4
Subject: [PATCH] fixed compilation
5
6
---
7
 ngx_rtmp.c             | 4 ++++
8
 ngx_rtmp.h             | 9 +++++++++
9
 ngx_rtmp_play_module.c | 8 +++++++-
10
 3 files changed, 20 insertions(+), 1 deletion(-)
11
12
diff --git a/ngx_rtmp.c b/ngx_rtmp.c
13
index c079c90..e525a93 100644
14
--- a/ngx_rtmp.c
15
+++ b/ngx_rtmp.c
16
@@ -31,7 +31,11 @@ static char * ngx_rtmp_merge_applications(ngx_conf_t *cf,
17
         ngx_uint_t ctx_index);
18
 
19
 
20
+#if (nginx_version >= 1007005)
21
+ngx_thread_volatile ngx_queue_t     ngx_rtmp_init_queue;
22
+#else
23
 ngx_thread_volatile ngx_event_t    *ngx_rtmp_init_queue;
24
+#endif
25
 
26
 
27
 ngx_uint_t  ngx_rtmp_max_module;
28
diff --git a/ngx_rtmp.h b/ngx_rtmp.h
29
index d3648f7..b87e99e 100644
30
--- a/ngx_rtmp.h
31
+++ b/ngx_rtmp.h
32
@@ -12,6 +12,7 @@
33
 #include <ngx_core.h>
34
 #include <ngx_event.h>
35
 #include <ngx_event_connect.h>
36
+#include <nginx.h>
37
 
38
 #include "ngx_rtmp_amf.h"
39
 #include "ngx_rtmp_bandwidth.h"
40
@@ -198,7 +199,11 @@ typedef struct {
41
     ngx_str_t              *addr_text;
42
     int                     connected;
43
 
44
+#if (nginx_version >= 1007005)
45
+    ngx_queue_t             posted_dry_events;
46
+#else
47
     ngx_event_t            *posted_dry_events;
48
+#endif
49
 
50
     /* client buffer time in msec */
51
     uint32_t                buflen;
52
@@ -602,7 +607,11 @@ extern ngx_rtmp_bandwidth_t                 ngx_rtmp_bw_in;
53
 
54
 
55
 extern ngx_uint_t                           ngx_rtmp_naccepted;
56
+#if (nginx_version >= 1007005)
57
+extern ngx_thread_volatile ngx_queue_t      ngx_rtmp_init_queue;
58
+#else
59
 extern ngx_thread_volatile ngx_event_t     *ngx_rtmp_init_queue;
60
+#endif
61
 
62
 extern ngx_uint_t                           ngx_rtmp_max_module;
63
 extern ngx_module_t                         ngx_rtmp_core_module;
64
diff --git a/ngx_rtmp_play_module.c b/ngx_rtmp_play_module.c
65
index acaa46c..f6ea6c3 100644
66
--- a/ngx_rtmp_play_module.c
67
+++ b/ngx_rtmp_play_module.c
68
@@ -6,6 +6,7 @@
69
 
70
 #include <ngx_config.h>
71
 #include <ngx_core.h>
72
+#include <nginx.h>
73
 #include "ngx_rtmp_play_module.h"
74
 #include "ngx_rtmp_cmd_module.h"
75
 #include "ngx_rtmp_netcall_module.h"
76
@@ -430,7 +431,12 @@ ngx_rtmp_play_do_stop(ngx_rtmp_session_t *s)
77
         ngx_del_timer(&ctx->send_evt);
78
     }
79
 
80
-    if (ctx->send_evt.prev) {
81
+#if (nginx_version >= 1007005)
82
+    if (ctx->send_evt.posted)
83
+#else
84
+    if (ctx->send_evt.prev)
85
+#endif
86
+    {
87
         ngx_delete_posted_event((&ctx->send_evt));
88
     }
89
 
(-)a/www-servers/nginx/metadata.xml (+27 lines)
Line 0 Link Here
1
<?xml version="1.0" encoding="UTF-8"?>
2
<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
3
<pkgmetadata>
4
	<herd>proxy-maintainers</herd>
5
	<maintainer>
6
		<email>dev-zero@gentoo.org</email>
7
		<name>Tiziano Müller</name>
8
	</maintainer>
9
	<maintainer>
10
		<email>bugs@bergstroem.nu</email>
11
		<name>Johan Bergström</name>
12
		<description>Co-maintainer, CC on bugs.</description>
13
	</maintainer>
14
	<use>
15
		<flag name='aio'>Enables file AIO support</flag>
16
		<flag name='http'>Enable HTTP core support</flag>
17
		<flag name='http-cache'>Enable HTTP cache support</flag>
18
		<flag name='libatomic'>Use libatomic instead of builtin atomic operations</flag>
19
		<flag name='luajit'>Use <pkg>dev-lang/luajit</pkg> instead of <pkg>dev-lang/lua</pkg> for lua support when building the lua http module.</flag>
20
		<flag name='pcre-jit'>Enable JIT for pcre</flag>
21
		<flag name='ssl'>Enable HTTPS module for http. Enable SSL/TLS support for POP3/IMAP/SMTP for mail.</flag>
22
		<flag name='rtmp'>NGINX-based Media Streaming Server</flag>
23
	</use>
24
	<upstream>
25
		<changelog>http://nginx.org/en/CHANGES</changelog>
26
	</upstream>
27
</pkgmetadata>
(-)a/www-servers/nginx/nginx-1.7.8-r99.ebuild (-1 / +678 lines)
Line 0 Link Here
0
- 
1
# Copyright 1999-2015 Gentoo Foundation
2
# Distributed under the terms of the GNU General Public License v2
3
# $Header: /var/cvsroot/gentoo-x86/www-servers/nginx/nginx-1.7.8.ebuild,v 1.1 2015/01/05 13:35:34 mrueg Exp $
4
5
EAPI="5"
6
7
# Maintainer notes:
8
# - http_rewrite-independent pcre-support makes sense for matching locations without an actual rewrite
9
# - any http-module activates the main http-functionality and overrides USE=-http
10
# - keep the following requirements in mind before adding external modules:
11
#   * alive upstream
12
#   * sane packaging
13
#   * builds cleanly
14
#   * does not need a patch for nginx core
15
# - TODO: test the google-perftools module (included in vanilla tarball)
16
17
# prevent perl-module from adding automagic perl DEPENDs
18
GENTOO_DEPEND_ON_PERL="no"
19
20
# devel_kit (https://github.com/simpl/ngx_devel_kit, BSD license)
21
DEVEL_KIT_MODULE_PV="0.2.19"
22
DEVEL_KIT_MODULE_P="ngx_devel_kit-${DEVEL_KIT_MODULE_PV}-r1"
23
DEVEL_KIT_MODULE_URI="https://github.com/simpl/ngx_devel_kit/archive/v${DEVEL_KIT_MODULE_PV}.tar.gz"
24
DEVEL_KIT_MODULE_WD="${WORKDIR}/ngx_devel_kit-${DEVEL_KIT_MODULE_PV}"
25
26
# http_uploadprogress (https://github.com/masterzen/nginx-upload-progress-module, BSD-2 license)
27
HTTP_UPLOAD_PROGRESS_MODULE_PV="0.9.1"
28
HTTP_UPLOAD_PROGRESS_MODULE_P="ngx_http_upload_progress-${HTTP_UPLOAD_PROGRESS_MODULE_PV}-r1"
29
HTTP_UPLOAD_PROGRESS_MODULE_URI="https://github.com/masterzen/nginx-upload-progress-module/archive/v${HTTP_UPLOAD_PROGRESS_MODULE_PV}.tar.gz"
30
HTTP_UPLOAD_PROGRESS_MODULE_WD="${WORKDIR}/nginx-upload-progress-module-${HTTP_UPLOAD_PROGRESS_MODULE_PV}"
31
32
# http_headers_more (http://github.com/agentzh/headers-more-nginx-module, BSD license)
33
HTTP_HEADERS_MORE_MODULE_PV="0.25"
34
HTTP_HEADERS_MORE_MODULE_P="ngx_http_headers_more-${HTTP_HEADERS_MORE_MODULE_PV}-r1"
35
HTTP_HEADERS_MORE_MODULE_URI="https://github.com/agentzh/headers-more-nginx-module/archive/v${HTTP_HEADERS_MORE_MODULE_PV}.tar.gz"
36
HTTP_HEADERS_MORE_MODULE_WD="${WORKDIR}/headers-more-nginx-module-${HTTP_HEADERS_MORE_MODULE_PV}"
37
38
# http_cache_purge (http://labs.frickle.com/nginx_ngx_cache_purge/, BSD-2 license)
39
HTTP_CACHE_PURGE_MODULE_PV="2.2"
40
HTTP_CACHE_PURGE_MODULE_P="ngx_http_cache_purge-${HTTP_CACHE_PURGE_MODULE_PV}"
41
HTTP_CACHE_PURGE_MODULE_URI="http://labs.frickle.com/files/ngx_cache_purge-${HTTP_CACHE_PURGE_MODULE_PV}.tar.gz"
42
HTTP_CACHE_PURGE_MODULE_WD="${WORKDIR}/ngx_cache_purge-${HTTP_CACHE_PURGE_MODULE_PV}"
43
44
# http_slowfs_cache (http://labs.frickle.com/nginx_ngx_slowfs_cache/, BSD-2 license)
45
HTTP_SLOWFS_CACHE_MODULE_PV="1.10"
46
HTTP_SLOWFS_CACHE_MODULE_P="ngx_http_slowfs_cache-${HTTP_SLOWFS_CACHE_MODULE_PV}"
47
HTTP_SLOWFS_CACHE_MODULE_URI="http://labs.frickle.com/files/ngx_slowfs_cache-${HTTP_SLOWFS_CACHE_MODULE_PV}.tar.gz"
48
HTTP_SLOWFS_CACHE_MODULE_WD="${WORKDIR}/ngx_slowfs_cache-${HTTP_SLOWFS_CACHE_MODULE_PV}"
49
50
# http_fancyindex (https://github.com/aperezdc/ngx-fancyindex, BSD license)
51
HTTP_FANCYINDEX_MODULE_PV="0.3.4"
52
HTTP_FANCYINDEX_MODULE_P="ngx_http_fancyindex-${HTTP_FANCYINDEX_MODULE_PV}"
53
HTTP_FANCYINDEX_MODULE_URI="https://github.com/aperezdc/ngx-fancyindex/archive/v${HTTP_FANCYINDEX_MODULE_PV}.tar.gz"
54
HTTP_FANCYINDEX_MODULE_WD="${WORKDIR}/ngx-fancyindex-${HTTP_FANCYINDEX_MODULE_PV}"
55
56
# http_lua (https://github.com/openresty/lua-nginx-module, BSD license)
57
HTTP_LUA_MODULE_PV="0.9.13"
58
HTTP_LUA_MODULE_P="ngx_http_lua-${HTTP_LUA_MODULE_PV}"
59
HTTP_LUA_MODULE_URI="https://github.com/openresty/lua-nginx-module/archive/v${HTTP_LUA_MODULE_PV}.tar.gz"
60
HTTP_LUA_MODULE_WD="${WORKDIR}/lua-nginx-module-${HTTP_LUA_MODULE_PV}"
61
62
# http_auth_pam (http://web.iti.upv.es/~sto/nginx/, BSD-2 license)
63
HTTP_AUTH_PAM_MODULE_PV="1.3"
64
HTTP_AUTH_PAM_MODULE_P="ngx_http_auth_pam-${HTTP_AUTH_PAM_MODULE_PV}"
65
HTTP_AUTH_PAM_MODULE_URI="http://web.iti.upv.es/~sto/nginx/ngx_http_auth_pam_module-${HTTP_AUTH_PAM_MODULE_PV}.tgz"
66
HTTP_AUTH_PAM_MODULE_WD="${WORKDIR}/ngx_http_auth_pam_module-${HTTP_AUTH_PAM_MODULE_PV}"
67
68
# http_upstream_check (https://github.com/yaoweibin/nginx_upstream_check_module, BSD license)
69
HTTP_UPSTREAM_CHECK_MODULE_PV="0.3.0"
70
HTTP_UPSTREAM_CHECK_MODULE_P="ngx_http_upstream_check-${HTTP_UPSTREAM_CHECK_MODULE_PV}"
71
HTTP_UPSTREAM_CHECK_MODULE_URI="https://github.com/yaoweibin/nginx_upstream_check_module/archive/v${HTTP_UPSTREAM_CHECK_MODULE_PV}.tar.gz"
72
HTTP_UPSTREAM_CHECK_MODULE_WD="${WORKDIR}/nginx_upstream_check_module-${HTTP_UPSTREAM_CHECK_MODULE_PV}"
73
74
# http_metrics (https://github.com/zenops/ngx_metrics, BSD license)
75
HTTP_METRICS_MODULE_PV="0.1.1"
76
HTTP_METRICS_MODULE_P="ngx_metrics-${HTTP_METRICS_MODULE_PV}"
77
HTTP_METRICS_MODULE_URI="https://github.com/madvertise/ngx_metrics/archive/v${HTTP_METRICS_MODULE_PV}.tar.gz"
78
HTTP_METRICS_MODULE_WD="${WORKDIR}/ngx_metrics-${HTTP_METRICS_MODULE_PV}"
79
80
# naxsi-core (https://github.com/nbs-system/naxsi, GPLv2+)
81
HTTP_NAXSI_MODULE_PV="0.53-2"
82
HTTP_NAXSI_MODULE_P="ngx_http_naxsi-${HTTP_NAXSI_MODULE_PV}"
83
HTTP_NAXSI_MODULE_URI="https://github.com/nbs-system/naxsi/archive/${HTTP_NAXSI_MODULE_PV}.tar.gz"
84
HTTP_NAXSI_MODULE_WD="${WORKDIR}/naxsi-${HTTP_NAXSI_MODULE_PV}/naxsi_src"
85
86
# nginx-rtmp-module (http://github.com/arut/nginx-rtmp-module, BSD license)
87
RTMP_MODULE_PV="1.1.6"
88
RTMP_MODULE_P="ngx_rtmp-${RTMP_MODULE_PV}"
89
RTMP_MODULE_URI="http://github.com/arut/nginx-rtmp-module/archive/v${RTMP_MODULE_PV}.tar.gz"
90
RTMP_MODULE_WD="${WORKDIR}/nginx-rtmp-module-${RTMP_MODULE_PV}"
91
92
# nginx-dav-ext-module (http://github.com/arut/nginx-dav-ext-module, BSD license)
93
HTTP_DAV_EXT_MODULE_PV="0.0.3"
94
HTTP_DAV_EXT_MODULE_P="ngx_http_dav_ext-${HTTP_DAV_EXT_MODULE_PV}"
95
HTTP_DAV_EXT_MODULE_URI="http://github.com/arut/nginx-dav-ext-module/archive/v${HTTP_DAV_EXT_MODULE_PV}.tar.gz"
96
HTTP_DAV_EXT_MODULE_WD="${WORKDIR}/nginx-dav-ext-module-${HTTP_DAV_EXT_MODULE_PV}"
97
98
# echo-nginx-module (https://github.com/agentzh/echo-nginx-module, BSD license)
99
HTTP_ECHO_MODULE_PV="0.57"
100
HTTP_ECHO_MODULE_P="ngx_http_echo-${HTTP_ECHO_MODULE_PV}"
101
HTTP_ECHO_MODULE_URI="https://github.com/agentzh/echo-nginx-module/archive/v${HTTP_ECHO_MODULE_PV}.tar.gz"
102
HTTP_ECHO_MODULE_WD="${WORKDIR}/echo-nginx-module-${HTTP_ECHO_MODULE_PV}"
103
104
# mod_security for nginx (https://modsecurity.org/, Apache-2.0)
105
# keep the MODULE_P here consistent with upstream to avoid tarball duplication
106
HTTP_SECURITY_MODULE_PV="2.8.0"
107
HTTP_SECURITY_MODULE_P="modsecurity-apache_${HTTP_SECURITY_MODULE_PV}"
108
HTTP_SECURITY_MODULE_URI="https://www.modsecurity.org/tarball/${HTTP_SECURITY_MODULE_PV}/${HTTP_SECURITY_MODULE_P}.tar.gz"
109
HTTP_SECURITY_MODULE_WD="${WORKDIR}/${HTTP_SECURITY_MODULE_P}"
110
111
# push-stream-module (http://www.nginxpushstream.com, https://github.com/wandenberg/nginx-push-stream-module, GPL-3)
112
HTTP_PUSH_STREAM_MODULE_PV="0.4.1"
113
HTTP_PUSH_STREAM_MODULE_P="ngx_http_push_stream-${HTTP_PUSH_STREAM_MODULE_PV}"
114
HTTP_PUSH_STREAM_MODULE_URI="https://github.com/wandenberg/nginx-push-stream-module/archive/${HTTP_PUSH_STREAM_MODULE_PV}.tar.gz"
115
HTTP_PUSH_STREAM_MODULE_WD="${WORKDIR}/nginx-push-stream-module-${HTTP_PUSH_STREAM_MODULE_PV}"
116
117
# sticky-module (https://bitbucket.org/nginx-goodies/nginx-sticky-module-ng, BSD-2)
118
HTTP_STICKY_MODULE_PV="1.2.5"
119
HTTP_STICKY_MODULE_P="nginx_http_sticky_module_ng-${HTTP_STICKY_MODULE_PV}"
120
HTTP_STICKY_MODULE_URI="https://bitbucket.org/nginx-goodies/nginx-sticky-module-ng/get/${HTTP_STICKY_MODULE_PV}.tar.bz2"
121
HTTP_STICKY_MODULE_WD="${WORKDIR}/nginx-goodies-nginx-sticky-module-ng-bd312d586752"
122
123
# ajp-module (https://github.com/yaoweibin/nginx_ajp_module, BSD-2)
124
HTTP_AJP_MODULE_PV="0.3.0"
125
HTTP_AJP_MODULE_P="ngx_http_ajp_module-${HTTP_AJP_MODULE_PV}"
126
HTTP_AJP_MODULE_URI="https://github.com/yaoweibin/nginx_ajp_module/archive/v${HTTP_AJP_MODULE_PV}.tar.gz"
127
HTTP_AJP_MODULE_WD="${WORKDIR}/nginx_ajp_module-${HTTP_AJP_MODULE_PV}"
128
129
# mogilefs-module (http://www.grid.net.ru/nginx/mogilefs.en.html, BSD-2)
130
HTTP_MOGILEFS_MODULE_PV="1.0.4"
131
HTTP_MOGILEFS_MODULE_P="ngx_mogilefs_module-${HTTP_MOGILEFS_MODULE_PV}"
132
HTTP_MOGILEFS_MODULE_URI="http://www.grid.net.ru/nginx/download/nginx_mogilefs_module-${HTTP_MOGILEFS_MODULE_PV}.tar.gz"
133
HTTP_MOGILEFS_MODULE_WD="${WORKDIR}/nginx_mogilefs_module-${HTTP_MOGILEFS_MODULE_PV}"
134
135
inherit eutils ssl-cert toolchain-funcs perl-module flag-o-matic user systemd versionator multilib
136
137
DESCRIPTION="Robust, small and high performance http and reverse proxy server"
138
HOMEPAGE="http://nginx.org"
139
SRC_URI="http://nginx.org/download/${P}.tar.gz
140
	${DEVEL_KIT_MODULE_URI} -> ${DEVEL_KIT_MODULE_P}.tar.gz
141
	nginx_modules_http_upload_progress? ( ${HTTP_UPLOAD_PROGRESS_MODULE_URI} -> ${HTTP_UPLOAD_PROGRESS_MODULE_P}.tar.gz )
142
	nginx_modules_http_headers_more? ( ${HTTP_HEADERS_MORE_MODULE_URI} -> ${HTTP_HEADERS_MORE_MODULE_P}.tar.gz )
143
	nginx_modules_http_cache_purge? ( ${HTTP_CACHE_PURGE_MODULE_URI} -> ${HTTP_CACHE_PURGE_MODULE_P}.tar.gz )
144
	nginx_modules_http_slowfs_cache? ( ${HTTP_SLOWFS_CACHE_MODULE_URI} -> ${HTTP_SLOWFS_CACHE_MODULE_P}.tar.gz )
145
	nginx_modules_http_fancyindex? ( ${HTTP_FANCYINDEX_MODULE_URI} -> ${HTTP_FANCYINDEX_MODULE_P}.tar.gz )
146
	nginx_modules_http_lua? ( ${HTTP_LUA_MODULE_URI} -> ${HTTP_LUA_MODULE_P}.tar.gz )
147
	nginx_modules_http_auth_pam? ( ${HTTP_AUTH_PAM_MODULE_URI} -> ${HTTP_AUTH_PAM_MODULE_P}.tar.gz )
148
	nginx_modules_http_upstream_check? ( ${HTTP_UPSTREAM_CHECK_MODULE_URI} -> ${HTTP_UPSTREAM_CHECK_MODULE_P}.tar.gz )
149
	nginx_modules_http_metrics? ( ${HTTP_METRICS_MODULE_URI} -> ${HTTP_METRICS_MODULE_P}.tar.gz )
150
	nginx_modules_http_naxsi? ( ${HTTP_NAXSI_MODULE_URI} -> ${HTTP_NAXSI_MODULE_P}.tar.gz )
151
	rtmp? ( ${RTMP_MODULE_URI} -> ${RTMP_MODULE_P}.tar.gz )
152
	nginx_modules_http_dav_ext? ( ${HTTP_DAV_EXT_MODULE_URI} -> ${HTTP_DAV_EXT_MODULE_P}.tar.gz )
153
	nginx_modules_http_echo? ( ${HTTP_ECHO_MODULE_URI} -> ${HTTP_ECHO_MODULE_P}.tar.gz )
154
	nginx_modules_http_security? ( ${HTTP_SECURITY_MODULE_URI} -> ${HTTP_SECURITY_MODULE_P}.tar.gz )
155
	nginx_modules_http_push_stream? ( ${HTTP_PUSH_STREAM_MODULE_URI} -> ${HTTP_PUSH_STREAM_MODULE_P}.tar.gz )
156
	nginx_modules_http_sticky? ( ${HTTP_STICKY_MODULE_URI} -> ${HTTP_STICKY_MODULE_P}.tar.bz2 )
157
	nginx_modules_http_ajp? ( ${HTTP_AJP_MODULE_URI} -> ${HTTP_AJP_MODULE_P}.tar.gz )
158
	nginx_modules_http_mogilefs? ( ${HTTP_MOGILEFS_MODULE_URI} -> ${HTTP_MOGILEFS_MODULE_P}.tar.gz )"
159
160
LICENSE="BSD-2 BSD SSLeay MIT GPL-2 GPL-2+
161
	nginx_modules_http_security? ( Apache-2.0 )
162
	nginx_modules_http_push_stream? ( GPL-3 )"
163
164
SLOT="0"
165
KEYWORDS="~amd64 ~arm ~mips ~ppc ~x86"
166
167
NGINX_MODULES_STD="access auth_basic autoindex browser charset empty_gif fastcgi
168
geo gzip limit_req limit_conn map memcached proxy referer rewrite scgi ssi
169
split_clients upstream_ip_hash userid uwsgi"
170
NGINX_MODULES_OPT="addition auth_request dav degradation flv geoip gunzip gzip_static
171
image_filter mp4 perl random_index realip secure_link spdy stub_status sub xslt"
172
NGINX_MODULES_MAIL="imap pop3 smtp"
173
NGINX_MODULES_3RD="
174
	http_upload_progress
175
	http_headers_more
176
	http_cache_purge
177
	http_slowfs_cache
178
	http_fancyindex
179
	http_lua
180
	http_auth_pam
181
	http_upstream_check
182
	http_metrics
183
	http_naxsi
184
	http_dav_ext
185
	http_echo
186
	http_security
187
	http_push_stream
188
	http_sticky
189
	http_ajp
190
	http_mogilefs"
191
192
IUSE="aio debug +http +http-cache ipv6 libatomic luajit +pcre pcre-jit rtmp
193
selinux ssl userland_GNU vim-syntax"
194
195
for mod in $NGINX_MODULES_STD; do
196
	IUSE="${IUSE} +nginx_modules_http_${mod}"
197
done
198
199
for mod in $NGINX_MODULES_OPT; do
200
	IUSE="${IUSE} nginx_modules_http_${mod}"
201
done
202
203
for mod in $NGINX_MODULES_MAIL; do
204
	IUSE="${IUSE} nginx_modules_mail_${mod}"
205
done
206
207
for mod in $NGINX_MODULES_3RD; do
208
	IUSE="${IUSE} nginx_modules_${mod}"
209
done
210
211
CDEPEND="
212
	pcre? ( >=dev-libs/libpcre-4.2 )
213
	pcre-jit? ( >=dev-libs/libpcre-8.20[jit] )
214
	ssl? ( dev-libs/openssl )
215
	http-cache? ( userland_GNU? ( dev-libs/openssl ) )
216
	nginx_modules_http_geoip? ( dev-libs/geoip )
217
	nginx_modules_http_gunzip? ( sys-libs/zlib )
218
	nginx_modules_http_gzip? ( sys-libs/zlib )
219
	nginx_modules_http_gzip_static? ( sys-libs/zlib )
220
	nginx_modules_http_image_filter? ( media-libs/gd[jpeg,png] )
221
	nginx_modules_http_perl? ( >=dev-lang/perl-5.8 )
222
	nginx_modules_http_rewrite? ( >=dev-libs/libpcre-4.2 )
223
	nginx_modules_http_secure_link? ( userland_GNU? ( dev-libs/openssl ) )
224
	nginx_modules_http_spdy? ( >=dev-libs/openssl-1.0.1c )
225
	nginx_modules_http_xslt? ( dev-libs/libxml2 dev-libs/libxslt )
226
	nginx_modules_http_lua? ( !luajit? ( dev-lang/lua ) luajit? ( dev-lang/luajit ) )
227
	nginx_modules_http_auth_pam? ( virtual/pam )
228
	nginx_modules_http_metrics? ( dev-libs/yajl )
229
	nginx_modules_http_dav_ext? ( dev-libs/expat )
230
	nginx_modules_http_security? ( >=dev-libs/libxml2-2.7.8 dev-libs/apr-util www-servers/apache )"
231
RDEPEND="${CDEPEND}
232
	selinux? ( sec-policy/selinux-nginx )
233
"
234
DEPEND="${CDEPEND}
235
	arm? ( dev-libs/libatomic_ops )
236
	libatomic? ( dev-libs/libatomic_ops )"
237
PDEPEND="vim-syntax? ( app-vim/nginx-syntax )"
238
239
REQUIRED_USE="pcre-jit? ( pcre )
240
	nginx_modules_http_lua? ( nginx_modules_http_rewrite )
241
	nginx_modules_http_naxsi? ( pcre )
242
	nginx_modules_http_dav_ext? ( nginx_modules_http_dav )
243
	nginx_modules_http_metrics? ( nginx_modules_http_stub_status )
244
	nginx_modules_http_security? ( pcre )
245
	nginx_modules_http_push_stream? ( ssl )"
246
247
pkg_setup() {
248
	NGINX_HOME="/var/lib/nginx"
249
	NGINX_HOME_TMP="${NGINX_HOME}/tmp"
250
251
	ebegin "Creating nginx user and group"
252
	enewgroup ${PN}
253
	enewuser ${PN} -1 -1 "${NGINX_HOME}" ${PN}
254
	eend $?
255
256
	if use libatomic; then
257
		ewarn "GCC 4.1+ features built-in atomic operations."
258
		ewarn "Using libatomic_ops is only needed if using"
259
		ewarn "a different compiler or a GCC prior to 4.1"
260
	fi
261
262
	if [[ -n $NGINX_ADD_MODULES ]]; then
263
		ewarn "You are building custom modules via \$NGINX_ADD_MODULES!"
264
		ewarn "This nginx installation is not supported!"
265
		ewarn "Make sure you can reproduce the bug without those modules"
266
		ewarn "_before_ reporting bugs."
267
	fi
268
269
	if use !http; then
270
		ewarn "To actually disable all http-functionality you also have to disable"
271
		ewarn "all nginx http modules."
272
	fi
273
}
274
275
src_prepare() {
276
	epatch "${FILESDIR}/${PN}-1.4.1-fix-perl-install-path.patch"
277
	epatch "${FILESDIR}/${PN}-1.7.8-fix-musl-crypt.patch"
278
279
	if use nginx_modules_http_upstream_check; then
280
		epatch "${FILESDIR}"/check_1.7.2+.patch
281
	fi
282
283
	if use nginx_modules_http_lua; then
284
		sed -i -e 's/-llua5.1/-llua/' "${HTTP_LUA_MODULE_WD}/config"
285
	fi
286
287
	find auto/ -type f -print0 | xargs -0 sed -i 's:\&\& make:\&\& \\$(MAKE):' || die
288
	# We have config protection, don't rename etc files
289
	sed -i 's:.default::' auto/install || die
290
	# remove useless files
291
	sed -i -e '/koi-/d' -e '/win-/d' auto/install || die
292
293
	# don't install to /etc/nginx/ if not in use
294
	local module
295
	for module in fastcgi scgi uwsgi ; do
296
		if ! use nginx_modules_http_${module}; then
297
			sed -i -e "/${module}/d" auto/install || die
298
		fi
299
	done
300
301
	epatch_user
302
}
303
304
src_configure() {
305
	# mod_security needs to generate nginx/modsecurity/config before including it
306
	if use nginx_modules_http_security; then
307
		cd "${HTTP_SECURITY_MODULE_WD}"
308
		if use luajit ; then
309
			sed -i \
310
				-e 's|^\(LUA_PKGNAMES\)=.*|\1="luajit"|' \
311
				configure || die
312
		fi
313
		./configure \
314
			--enable-standalone-module \
315
			$(use_enable pcre-jit) \
316
			$(use_with nginx_modules_http_lua lua) || die "configure failed for mod_security"
317
	fi
318
319
	cd "${S}"
320
321
	local myconf= http_enabled= mail_enabled=
322
323
	use aio       && myconf+=" --with-file-aio --with-aio_module"
324
	use debug     && myconf+=" --with-debug"
325
	use ipv6      && myconf+=" --with-ipv6"
326
	use libatomic && myconf+=" --with-libatomic"
327
	use pcre      && myconf+=" --with-pcre"
328
	use pcre-jit  && myconf+=" --with-pcre-jit"
329
330
	# HTTP modules
331
	for mod in $NGINX_MODULES_STD; do
332
		if use nginx_modules_http_${mod}; then
333
			http_enabled=1
334
		else
335
			myconf+=" --without-http_${mod}_module"
336
		fi
337
	done
338
339
	for mod in $NGINX_MODULES_OPT; do
340
		if use nginx_modules_http_${mod}; then
341
			http_enabled=1
342
			myconf+=" --with-http_${mod}_module"
343
		fi
344
	done
345
346
	if use nginx_modules_http_fastcgi; then
347
		myconf+=" --with-http_realip_module"
348
	fi
349
350
	# third-party modules
351
	if use nginx_modules_http_upload_progress; then
352
		http_enabled=1
353
		myconf+=" --add-module=${HTTP_UPLOAD_PROGRESS_MODULE_WD}"
354
	fi
355
356
	if use nginx_modules_http_headers_more; then
357
		http_enabled=1
358
		myconf+=" --add-module=${HTTP_HEADERS_MORE_MODULE_WD}"
359
	fi
360
361
	if use nginx_modules_http_cache_purge; then
362
		http_enabled=1
363
		myconf+=" --add-module=${HTTP_CACHE_PURGE_MODULE_WD}"
364
	fi
365
366
	if use nginx_modules_http_slowfs_cache; then
367
		http_enabled=1
368
		myconf+=" --add-module=${HTTP_SLOWFS_CACHE_MODULE_WD}"
369
	fi
370
371
	if use nginx_modules_http_fancyindex; then
372
		http_enabled=1
373
		myconf+=" --add-module=${HTTP_FANCYINDEX_MODULE_WD}"
374
	fi
375
376
	if use nginx_modules_http_lua; then
377
		http_enabled=1
378
		if use luajit; then
379
			export LUAJIT_LIB=$(pkg-config --variable libdir luajit)
380
			export LUAJIT_INC=$(pkg-config --variable includedir luajit)
381
		else
382
			export LUA_LIB=$(pkg-config --variable libdir lua)
383
			export LUA_INC=$(pkg-config --variable includedir lua)
384
		fi
385
		myconf+=" --add-module=${DEVEL_KIT_MODULE_WD}"
386
		myconf+=" --add-module=${HTTP_LUA_MODULE_WD}"
387
	fi
388
389
	if use nginx_modules_http_auth_pam; then
390
		http_enabled=1
391
		myconf+=" --add-module=${HTTP_AUTH_PAM_MODULE_WD}"
392
	fi
393
394
	if use nginx_modules_http_upstream_check; then
395
		http_enabled=1
396
		myconf+=" --add-module=${HTTP_UPSTREAM_CHECK_MODULE_WD}"
397
	fi
398
399
	if use nginx_modules_http_metrics; then
400
		http_enabled=1
401
		myconf+=" --add-module=${HTTP_METRICS_MODULE_WD}"
402
	fi
403
404
	if use nginx_modules_http_naxsi ; then
405
		http_enabled=1
406
		myconf+=" --add-module=${HTTP_NAXSI_MODULE_WD}"
407
	fi
408
409
	if use rtmp ; then
410
		http_enabled=1
411
		myconf+=" --add-module=${RTMP_MODULE_WD}"
412
	fi
413
414
	if use nginx_modules_http_dav_ext ; then
415
		http_enabled=1
416
		myconf+=" --add-module=${HTTP_DAV_EXT_MODULE_WD}"
417
	fi
418
419
	if use nginx_modules_http_echo ; then
420
		http_enabled=1
421
		myconf+=" --add-module=${HTTP_ECHO_MODULE_WD}"
422
	fi
423
424
	if use nginx_modules_http_security ; then
425
		http_enabled=1
426
		myconf+=" --add-module=${HTTP_SECURITY_MODULE_WD}/nginx/modsecurity"
427
	fi
428
429
	if use nginx_modules_http_push_stream ; then
430
		http_enabled=1
431
		myconf+=" --add-module=${HTTP_PUSH_STREAM_MODULE_WD}"
432
	fi
433
434
	if use nginx_modules_http_sticky ; then
435
		http_enabled=1
436
		myconf+=" --add-module=${HTTP_STICKY_MODULE_WD}"
437
	fi
438
439
	if use nginx_modules_http_ajp ; then
440
		http_enabled=1
441
		myconf+=" --add-module=${HTTP_AJP_MODULE_WD}"
442
	fi
443
444
	if use nginx_modules_http_mogilefs ; then
445
		http_enabled=1
446
		myconf+=" --add-module=${HTTP_MOGILEFS_MODULE_WD}"
447
	fi
448
449
	if use http || use http-cache; then
450
		http_enabled=1
451
	fi
452
453
	if [ $http_enabled ]; then
454
		use http-cache || myconf+=" --without-http-cache"
455
		use ssl && myconf+=" --with-http_ssl_module"
456
	else
457
		myconf+=" --without-http --without-http-cache"
458
	fi
459
460
	# MAIL modules
461
	for mod in $NGINX_MODULES_MAIL; do
462
		if use nginx_modules_mail_${mod}; then
463
			mail_enabled=1
464
		else
465
			myconf+=" --without-mail_${mod}_module"
466
		fi
467
	done
468
469
	if [ $mail_enabled ]; then
470
		myconf+=" --with-mail"
471
		use ssl && myconf+=" --with-mail_ssl_module"
472
	fi
473
474
	# custom modules
475
	for mod in $NGINX_ADD_MODULES; do
476
		myconf+=" --add-module=${mod}"
477
	done
478
479
	# https://bugs.gentoo.org/286772
480
	export LANG=C LC_ALL=C
481
	tc-export CC
482
483
	if ! use prefix; then
484
		myconf+=" --user=${PN} --group=${PN}"
485
	fi
486
487
	./configure \
488
		--prefix="${EPREFIX}"/usr \
489
		--conf-path="${EPREFIX}"/etc/${PN}/${PN}.conf \
490
		--error-log-path="${EPREFIX}"/var/log/${PN}/error_log \
491
		--pid-path="${EPREFIX}"/run/${PN}.pid \
492
		--lock-path="${EPREFIX}"/run/lock/${PN}.lock \
493
		--with-cc-opt="-I${EROOT}usr/include" \
494
		--with-ld-opt="-L${EROOT}usr/$(get_libdir)" \
495
		--http-log-path="${EPREFIX}"/var/log/${PN}/access_log \
496
		--http-client-body-temp-path="${EPREFIX}/${NGINX_HOME_TMP}"/client \
497
		--http-proxy-temp-path="${EPREFIX}/${NGINX_HOME_TMP}"/proxy \
498
		--http-fastcgi-temp-path="${EPREFIX}/${NGINX_HOME_TMP}"/fastcgi \
499
		--http-scgi-temp-path="${EPREFIX}/${NGINX_HOME_TMP}"/scgi \
500
		--http-uwsgi-temp-path="${EPREFIX}/${NGINX_HOME_TMP}"/uwsgi \
501
		${myconf} || die "configure failed"
502
503
	# A purely cosmetic change that makes nginx -V more readable. This can be
504
	# good if people outside the gentoo community would troubleshoot and
505
	# question the users setup.
506
	sed -i -e "s|${WORKDIR}|external_module|g" objs/ngx_auto_config.h || die
507
}
508
509
src_compile() {
510
	use nginx_modules_http_security && emake -C "${HTTP_SECURITY_MODULE_WD}"
511
512
	# https://bugs.gentoo.org/286772
513
	export LANG=C LC_ALL=C
514
	emake LINK="${CC} ${LDFLAGS}" OTHERLDFLAGS="${LDFLAGS}"
515
}
516
517
src_install() {
518
	emake DESTDIR="${D}" install
519
520
	cp "${FILESDIR}"/nginx.conf "${ED}"/etc/nginx/nginx.conf || die
521
522
	newinitd "${FILESDIR}"/nginx.initd-r2 nginx
523
524
	systemd_newunit "${FILESDIR}"/nginx.service-r1 nginx.service
525
526
	doman man/nginx.8
527
	dodoc CHANGES* README
528
529
	# just keepdir. do not copy the default htdocs files (bug #449136)
530
	keepdir /var/www/localhost
531
	rm -rf "${D}"/usr/html || die
532
533
	# set up a list of directories to keep
534
	local keepdir_list="${NGINX_HOME_TMP}"/client
535
	local module
536
	for module in proxy fastcgi scgi uwsgi; do
537
		use nginx_modules_http_${module} && keepdir_list+=" ${NGINX_HOME_TMP}/${module}"
538
	done
539
540
	keepdir /var/log/nginx ${keepdir_list}
541
542
	# this solves a problem with SELinux where nginx doesn't see the directories
543
	# as root and tries to create them as nginx
544
	fperms 0750 "${NGINX_HOME_TMP}"
545
	fowners ${PN}:0 "${NGINX_HOME_TMP}"
546
547
	fperms 0700 /var/log/nginx ${keepdir_list}
548
	fowners ${PN}:${PN} /var/log/nginx ${keepdir_list}
549
550
	# logrotate
551
	insinto /etc/logrotate.d
552
	newins "${FILESDIR}"/nginx.logrotate-r1 nginx
553
554
	if use nginx_modules_http_perl; then
555
		cd "${S}"/objs/src/http/modules/perl/
556
		einstall DESTDIR="${D}" INSTALLDIRS=vendor
557
		perl_delete_localpod
558
	fi
559
560
	if use nginx_modules_http_cache_purge; then
561
		docinto ${HTTP_CACHE_PURGE_MODULE_P}
562
		dodoc "${HTTP_CACHE_PURGE_MODULE_WD}"/{CHANGES,README.md,TODO.md}
563
	fi
564
565
	if use nginx_modules_http_slowfs_cache; then
566
		docinto ${HTTP_SLOWFS_CACHE_MODULE_P}
567
		dodoc "${HTTP_SLOWFS_CACHE_MODULE_WD}"/{CHANGES,README.md}
568
	fi
569
570
	if use nginx_modules_http_fancyindex; then
571
		docinto ${HTTP_FANCYINDEX_MODULE_P}
572
		dodoc "${HTTP_FANCYINDEX_MODULE_WD}"/README.rst
573
	fi
574
575
	if use nginx_modules_http_lua; then
576
		docinto ${HTTP_LUA_MODULE_P}
577
		dodoc "${HTTP_LUA_MODULE_WD}"/{Changes,README.markdown}
578
	fi
579
580
	if use nginx_modules_http_auth_pam; then
581
		docinto ${HTTP_AUTH_PAM_MODULE_P}
582
		dodoc "${HTTP_AUTH_PAM_MODULE_WD}"/{README,ChangeLog}
583
	fi
584
585
	if use nginx_modules_http_upstream_check; then
586
		docinto ${HTTP_UPSTREAM_CHECK_MODULE_P}
587
		dodoc "${HTTP_UPSTREAM_CHECK_MODULE_WD}"/{README,CHANGES}
588
	fi
589
590
# README.md is still empty
591
#	if use nginx_modules_http_metrics; then
592
#		docinto ${HTTP_METRICS_MODULE_P}
593
#		dodoc "${HTTP_METRICS_MODULE_WD}"/README.md
594
#	fi
595
596
	if use nginx_modules_http_naxsi; then
597
		insinto /etc/nginx
598
		doins "${HTTP_NAXSI_MODULE_WD}"/../naxsi_config/naxsi_core.rules
599
	fi
600
601
	if use rtmp; then
602
		docinto ${RTMP_MODULE_P}
603
		dodoc "${RTMP_MODULE_WD}"/{AUTHORS,README.md,stat.xsl}
604
	fi
605
606
	if use nginx_modules_http_dav_ext; then
607
		docinto ${HTTP_DAV_EXT_MODULE_P}
608
		dodoc "${HTTP_DAV_EXT_MODULE_WD}"/README
609
	fi
610
611
	if use nginx_modules_http_echo; then
612
		docinto ${HTTP_ECHO_MODULE_P}
613
		dodoc "${HTTP_ECHO_MODULE_WD}"/{README.markdown,doc/HttpEchoModule.wiki}
614
	fi
615
616
	if use nginx_modules_http_security; then
617
		docinto ${HTTP_SECURITY_MODULE_P}
618
		dodoc "${HTTP_SECURITY_MODULE_WD}"/{CHANGES,README.TXT,authors.txt}
619
	fi
620
621
	if use nginx_modules_http_push_stream; then
622
		docinto ${HTTP_PUSH_STREAM_MODULE_P}
623
		dodoc "${HTTP_PUSH_STREAM_MODULE_WD}"/{AUTHORS,CHANGELOG.textile,README.textile}
624
	fi
625
626
	if use nginx_modules_http_sticky; then
627
		docinto ${HTTP_STICKY_MODULE_P}
628
		dodoc "${HTTP_STICKY_MODULE_WD}"/{README.md,Changelog.txt,docs/sticky.pdf}
629
	fi
630
631
	if use nginx_modules_http_ajp; then
632
		docinto ${HTTP_AJP_MODULE_P}
633
		dodoc "${HTTP_AJP_MODULE_WD}"/README
634
	fi
635
}
636
637
pkg_postinst() {
638
	if use ssl; then
639
		if [ ! -f "${EROOT}"/etc/ssl/${PN}/${PN}.key ]; then
640
			install_cert /etc/ssl/${PN}/${PN}
641
			use prefix || chown ${PN}:${PN} "${EROOT}"/etc/ssl/${PN}/${PN}.{crt,csr,key,pem}
642
		fi
643
	fi
644
645
	if use nginx_modules_http_lua && use nginx_modules_http_spdy; then
646
		ewarn "Lua 3rd party module author warns against using ${P} with"
647
		ewarn "NGINX_MODULES_HTTP=\"lua spdy\". For more info, see http://git.io/OldLsg"
648
	fi
649
650
	# This is the proper fix for bug #458726/#469094, resp. CVE-2013-0337 for
651
	# existing installations
652
	local fix_perms=0
653
654
	for rv in ${REPLACING_VERSIONS} ; do
655
		version_compare ${rv} 1.4.1-r2
656
		[[ $? -eq 1 ]] && fix_perms=1
657
	done
658
659
	if [[ $fix_perms -eq 1 ]] ; then
660
		ewarn "To fix a security bug (CVE-2013-0337, bug #458726) had the following"
661
		ewarn "directories the world-readable bit removed (if set):"
662
		ewarn "  ${EPREFIX}/var/log/nginx"
663
		ewarn "  ${EPREFIX}${NGINX_HOME_TMP}/{,client,proxy,fastcgi,scgi,uwsgi}"
664
		ewarn "Check if this is correct for your setup before restarting nginx!"
665
		ewarn "This is a one-time change and will not happen on subsequent updates."
666
		ewarn "Furthermore nginx' temp directories got moved to ${NGINX_HOME_TMP}"
667
		chmod -f o-rwx "${EPREFIX}"/var/log/nginx "${EPREFIX}/${NGINX_HOME_TMP}"/{,client,proxy,fastcgi,scgi,uwsgi}
668
	fi
669
670
	# If the nginx user can't change into or read the dir, display a warning.
671
	# If su is not available we display the warning nevertheless since we can't check properly
672
	su -s /bin/sh -c 'cd /var/log/nginx/ && ls' nginx >&/dev/null
673
	if [ $? -ne 0 ] ; then
674
		ewarn "Please make sure that the nginx user or group has at least"
675
		ewarn "'rx' permissions on /var/log/nginx (default on a fresh install)"
676
		ewarn "Otherwise you end up with empty log files after a logrotate."
677
	fi
678
}

Return to bug 533570