├── LICENSE ├── README.md ├── includes ├── conf │ ├── embedded │ │ └── monkey.conf │ ├── monkey.conf │ └── monkeyIPv6.conf ├── init.d │ ├── monkey │ └── monkeyIPv6 ├── php5 │ └── www.conf ├── plugins │ └── fastcgi │ │ └── fastcgi.conf ├── sites │ └── default └── supervisor │ └── monkey.conf └── monkeyServer.sh /LICENSE: -------------------------------------------------------------------------------- 1 | GNU GENERAL PUBLIC LICENSE 2 | Version 3, 29 June 2007 3 | 4 | Copyright (C) 2007 Free Software Foundation, Inc. 5 | Everyone is permitted to copy and distribute verbatim copies 6 | of this license document, but changing it is not allowed. 7 | 8 | Preamble 9 | 10 | The GNU General Public License is a free, copyleft license for 11 | software and other kinds of works. 12 | 13 | The licenses for most software and other practical works are designed 14 | to take away your freedom to share and change the works. By contrast, 15 | the GNU General Public License is intended to guarantee your freedom to 16 | share and change all versions of a program--to make sure it remains free 17 | software for all its users. We, the Free Software Foundation, use the 18 | GNU General Public License for most of our software; it applies also to 19 | any other work released this way by its authors. You can apply it to 20 | your programs, too. 21 | 22 | When we speak of free software, we are referring to freedom, not 23 | price. Our General Public Licenses are designed to make sure that you 24 | have the freedom to distribute copies of free software (and charge for 25 | them if you wish), that you receive source code or can get it if you 26 | want it, that you can change the software or use pieces of it in new 27 | free programs, and that you know you can do these things. 28 | 29 | To protect your rights, we need to prevent others from denying you 30 | these rights or asking you to surrender the rights. Therefore, you have 31 | certain responsibilities if you distribute copies of the software, or if 32 | you modify it: responsibilities to respect the freedom of others. 33 | 34 | For example, if you distribute copies of such a program, whether 35 | gratis or for a fee, you must pass on to the recipients the same 36 | freedoms that you received. You must make sure that they, too, receive 37 | or can get the source code. And you must show them these terms so they 38 | know their rights. 39 | 40 | Developers that use the GNU GPL protect your rights with two steps: 41 | (1) assert copyright on the software, and (2) offer you this License 42 | giving you legal permission to copy, distribute and/or modify it. 43 | 44 | For the developers' and authors' protection, the GPL clearly explains 45 | that there is no warranty for this free software. For both users' and 46 | authors' sake, the GPL requires that modified versions be marked as 47 | changed, so that their problems will not be attributed erroneously to 48 | authors of previous versions. 49 | 50 | Some devices are designed to deny users access to install or run 51 | modified versions of the software inside them, although the manufacturer 52 | can do so. This is fundamentally incompatible with the aim of 53 | protecting users' freedom to change the software. The systematic 54 | pattern of such abuse occurs in the area of products for individuals to 55 | use, which is precisely where it is most unacceptable. Therefore, we 56 | have designed this version of the GPL to prohibit the practice for those 57 | products. If such problems arise substantially in other domains, we 58 | stand ready to extend this provision to those domains in future versions 59 | of the GPL, as needed to protect the freedom of users. 60 | 61 | Finally, every program is threatened constantly by software patents. 62 | States should not allow patents to restrict development and use of 63 | software on general-purpose computers, but in those that do, we wish to 64 | avoid the special danger that patents applied to a free program could 65 | make it effectively proprietary. To prevent this, the GPL assures that 66 | patents cannot be used to render the program non-free. 67 | 68 | The precise terms and conditions for copying, distribution and 69 | modification follow. 70 | 71 | TERMS AND CONDITIONS 72 | 73 | 0. Definitions. 74 | 75 | "This License" refers to version 3 of the GNU General Public License. 76 | 77 | "Copyright" also means copyright-like laws that apply to other kinds of 78 | works, such as semiconductor masks. 79 | 80 | "The Program" refers to any copyrightable work licensed under this 81 | License. Each licensee is addressed as "you". "Licensees" and 82 | "recipients" may be individuals or organizations. 83 | 84 | To "modify" a work means to copy from or adapt all or part of the work 85 | in a fashion requiring copyright permission, other than the making of an 86 | exact copy. The resulting work is called a "modified version" of the 87 | earlier work or a work "based on" the earlier work. 88 | 89 | A "covered work" means either the unmodified Program or a work based 90 | on the Program. 91 | 92 | To "propagate" a work means to do anything with it that, without 93 | permission, would make you directly or secondarily liable for 94 | infringement under applicable copyright law, except executing it on a 95 | computer or modifying a private copy. Propagation includes copying, 96 | distribution (with or without modification), making available to the 97 | public, and in some countries other activities as well. 98 | 99 | To "convey" a work means any kind of propagation that enables other 100 | parties to make or receive copies. Mere interaction with a user through 101 | a computer network, with no transfer of a copy, is not conveying. 102 | 103 | An interactive user interface displays "Appropriate Legal Notices" 104 | to the extent that it includes a convenient and prominently visible 105 | feature that (1) displays an appropriate copyright notice, and (2) 106 | tells the user that there is no warranty for the work (except to the 107 | extent that warranties are provided), that licensees may convey the 108 | work under this License, and how to view a copy of this License. If 109 | the interface presents a list of user commands or options, such as a 110 | menu, a prominent item in the list meets this criterion. 111 | 112 | 1. Source Code. 113 | 114 | The "source code" for a work means the preferred form of the work 115 | for making modifications to it. "Object code" means any non-source 116 | form of a work. 117 | 118 | A "Standard Interface" means an interface that either is an official 119 | standard defined by a recognized standards body, or, in the case of 120 | interfaces specified for a particular programming language, one that 121 | is widely used among developers working in that language. 122 | 123 | The "System Libraries" of an executable work include anything, other 124 | than the work as a whole, that (a) is included in the normal form of 125 | packaging a Major Component, but which is not part of that Major 126 | Component, and (b) serves only to enable use of the work with that 127 | Major Component, or to implement a Standard Interface for which an 128 | implementation is available to the public in source code form. A 129 | "Major Component", in this context, means a major essential component 130 | (kernel, window system, and so on) of the specific operating system 131 | (if any) on which the executable work runs, or a compiler used to 132 | produce the work, or an object code interpreter used to run it. 133 | 134 | The "Corresponding Source" for a work in object code form means all 135 | the source code needed to generate, install, and (for an executable 136 | work) run the object code and to modify the work, including scripts to 137 | control those activities. However, it does not include the work's 138 | System Libraries, or general-purpose tools or generally available free 139 | programs which are used unmodified in performing those activities but 140 | which are not part of the work. For example, Corresponding Source 141 | includes interface definition files associated with source files for 142 | the work, and the source code for shared libraries and dynamically 143 | linked subprograms that the work is specifically designed to require, 144 | such as by intimate data communication or control flow between those 145 | subprograms and other parts of the work. 146 | 147 | The Corresponding Source need not include anything that users 148 | can regenerate automatically from other parts of the Corresponding 149 | Source. 150 | 151 | The Corresponding Source for a work in source code form is that 152 | same work. 153 | 154 | 2. Basic Permissions. 155 | 156 | All rights granted under this License are granted for the term of 157 | copyright on the Program, and are irrevocable provided the stated 158 | conditions are met. This License explicitly affirms your unlimited 159 | permission to run the unmodified Program. The output from running a 160 | covered work is covered by this License only if the output, given its 161 | content, constitutes a covered work. This License acknowledges your 162 | rights of fair use or other equivalent, as provided by copyright law. 163 | 164 | You may make, run and propagate covered works that you do not 165 | convey, without conditions so long as your license otherwise remains 166 | in force. You may convey covered works to others for the sole purpose 167 | of having them make modifications exclusively for you, or provide you 168 | with facilities for running those works, provided that you comply with 169 | the terms of this License in conveying all material for which you do 170 | not control copyright. Those thus making or running the covered works 171 | for you must do so exclusively on your behalf, under your direction 172 | and control, on terms that prohibit them from making any copies of 173 | your copyrighted material outside their relationship with you. 174 | 175 | Conveying under any other circumstances is permitted solely under 176 | the conditions stated below. Sublicensing is not allowed; section 10 177 | makes it unnecessary. 178 | 179 | 3. Protecting Users' Legal Rights From Anti-Circumvention Law. 180 | 181 | No covered work shall be deemed part of an effective technological 182 | measure under any applicable law fulfilling obligations under article 183 | 11 of the WIPO copyright treaty adopted on 20 December 1996, or 184 | similar laws prohibiting or restricting circumvention of such 185 | measures. 186 | 187 | When you convey a covered work, you waive any legal power to forbid 188 | circumvention of technological measures to the extent such circumvention 189 | is effected by exercising rights under this License with respect to 190 | the covered work, and you disclaim any intention to limit operation or 191 | modification of the work as a means of enforcing, against the work's 192 | users, your or third parties' legal rights to forbid circumvention of 193 | technological measures. 194 | 195 | 4. Conveying Verbatim Copies. 196 | 197 | You may convey verbatim copies of the Program's source code as you 198 | receive it, in any medium, provided that you conspicuously and 199 | appropriately publish on each copy an appropriate copyright notice; 200 | keep intact all notices stating that this License and any 201 | non-permissive terms added in accord with section 7 apply to the code; 202 | keep intact all notices of the absence of any warranty; and give all 203 | recipients a copy of this License along with the Program. 204 | 205 | You may charge any price or no price for each copy that you convey, 206 | and you may offer support or warranty protection for a fee. 207 | 208 | 5. Conveying Modified Source Versions. 209 | 210 | You may convey a work based on the Program, or the modifications to 211 | produce it from the Program, in the form of source code under the 212 | terms of section 4, provided that you also meet all of these conditions: 213 | 214 | a) The work must carry prominent notices stating that you modified 215 | it, and giving a relevant date. 216 | 217 | b) The work must carry prominent notices stating that it is 218 | released under this License and any conditions added under section 219 | 7. This requirement modifies the requirement in section 4 to 220 | "keep intact all notices". 221 | 222 | c) You must license the entire work, as a whole, under this 223 | License to anyone who comes into possession of a copy. This 224 | License will therefore apply, along with any applicable section 7 225 | additional terms, to the whole of the work, and all its parts, 226 | regardless of how they are packaged. This License gives no 227 | permission to license the work in any other way, but it does not 228 | invalidate such permission if you have separately received it. 229 | 230 | d) If the work has interactive user interfaces, each must display 231 | Appropriate Legal Notices; however, if the Program has interactive 232 | interfaces that do not display Appropriate Legal Notices, your 233 | work need not make them do so. 234 | 235 | A compilation of a covered work with other separate and independent 236 | works, which are not by their nature extensions of the covered work, 237 | and which are not combined with it such as to form a larger program, 238 | in or on a volume of a storage or distribution medium, is called an 239 | "aggregate" if the compilation and its resulting copyright are not 240 | used to limit the access or legal rights of the compilation's users 241 | beyond what the individual works permit. Inclusion of a covered work 242 | in an aggregate does not cause this License to apply to the other 243 | parts of the aggregate. 244 | 245 | 6. Conveying Non-Source Forms. 246 | 247 | You may convey a covered work in object code form under the terms 248 | of sections 4 and 5, provided that you also convey the 249 | machine-readable Corresponding Source under the terms of this License, 250 | in one of these ways: 251 | 252 | a) Convey the object code in, or embodied in, a physical product 253 | (including a physical distribution medium), accompanied by the 254 | Corresponding Source fixed on a durable physical medium 255 | customarily used for software interchange. 256 | 257 | b) Convey the object code in, or embodied in, a physical product 258 | (including a physical distribution medium), accompanied by a 259 | written offer, valid for at least three years and valid for as 260 | long as you offer spare parts or customer support for that product 261 | model, to give anyone who possesses the object code either (1) a 262 | copy of the Corresponding Source for all the software in the 263 | product that is covered by this License, on a durable physical 264 | medium customarily used for software interchange, for a price no 265 | more than your reasonable cost of physically performing this 266 | conveying of source, or (2) access to copy the 267 | Corresponding Source from a network server at no charge. 268 | 269 | c) Convey individual copies of the object code with a copy of the 270 | written offer to provide the Corresponding Source. This 271 | alternative is allowed only occasionally and noncommercially, and 272 | only if you received the object code with such an offer, in accord 273 | with subsection 6b. 274 | 275 | d) Convey the object code by offering access from a designated 276 | place (gratis or for a charge), and offer equivalent access to the 277 | Corresponding Source in the same way through the same place at no 278 | further charge. You need not require recipients to copy the 279 | Corresponding Source along with the object code. If the place to 280 | copy the object code is a network server, the Corresponding Source 281 | may be on a different server (operated by you or a third party) 282 | that supports equivalent copying facilities, provided you maintain 283 | clear directions next to the object code saying where to find the 284 | Corresponding Source. Regardless of what server hosts the 285 | Corresponding Source, you remain obligated to ensure that it is 286 | available for as long as needed to satisfy these requirements. 287 | 288 | e) Convey the object code using peer-to-peer transmission, provided 289 | you inform other peers where the object code and Corresponding 290 | Source of the work are being offered to the general public at no 291 | charge under subsection 6d. 292 | 293 | A separable portion of the object code, whose source code is excluded 294 | from the Corresponding Source as a System Library, need not be 295 | included in conveying the object code work. 296 | 297 | A "User Product" is either (1) a "consumer product", which means any 298 | tangible personal property which is normally used for personal, family, 299 | or household purposes, or (2) anything designed or sold for incorporation 300 | into a dwelling. In determining whether a product is a consumer product, 301 | doubtful cases shall be resolved in favor of coverage. For a particular 302 | product received by a particular user, "normally used" refers to a 303 | typical or common use of that class of product, regardless of the status 304 | of the particular user or of the way in which the particular user 305 | actually uses, or expects or is expected to use, the product. A product 306 | is a consumer product regardless of whether the product has substantial 307 | commercial, industrial or non-consumer uses, unless such uses represent 308 | the only significant mode of use of the product. 309 | 310 | "Installation Information" for a User Product means any methods, 311 | procedures, authorization keys, or other information required to install 312 | and execute modified versions of a covered work in that User Product from 313 | a modified version of its Corresponding Source. The information must 314 | suffice to ensure that the continued functioning of the modified object 315 | code is in no case prevented or interfered with solely because 316 | modification has been made. 317 | 318 | If you convey an object code work under this section in, or with, or 319 | specifically for use in, a User Product, and the conveying occurs as 320 | part of a transaction in which the right of possession and use of the 321 | User Product is transferred to the recipient in perpetuity or for a 322 | fixed term (regardless of how the transaction is characterized), the 323 | Corresponding Source conveyed under this section must be accompanied 324 | by the Installation Information. But this requirement does not apply 325 | if neither you nor any third party retains the ability to install 326 | modified object code on the User Product (for example, the work has 327 | been installed in ROM). 328 | 329 | The requirement to provide Installation Information does not include a 330 | requirement to continue to provide support service, warranty, or updates 331 | for a work that has been modified or installed by the recipient, or for 332 | the User Product in which it has been modified or installed. Access to a 333 | network may be denied when the modification itself materially and 334 | adversely affects the operation of the network or violates the rules and 335 | protocols for communication across the network. 336 | 337 | Corresponding Source conveyed, and Installation Information provided, 338 | in accord with this section must be in a format that is publicly 339 | documented (and with an implementation available to the public in 340 | source code form), and must require no special password or key for 341 | unpacking, reading or copying. 342 | 343 | 7. Additional Terms. 344 | 345 | "Additional permissions" are terms that supplement the terms of this 346 | License by making exceptions from one or more of its conditions. 347 | Additional permissions that are applicable to the entire Program shall 348 | be treated as though they were included in this License, to the extent 349 | that they are valid under applicable law. If additional permissions 350 | apply only to part of the Program, that part may be used separately 351 | under those permissions, but the entire Program remains governed by 352 | this License without regard to the additional permissions. 353 | 354 | When you convey a copy of a covered work, you may at your option 355 | remove any additional permissions from that copy, or from any part of 356 | it. (Additional permissions may be written to require their own 357 | removal in certain cases when you modify the work.) You may place 358 | additional permissions on material, added by you to a covered work, 359 | for which you have or can give appropriate copyright permission. 360 | 361 | Notwithstanding any other provision of this License, for material you 362 | add to a covered work, you may (if authorized by the copyright holders of 363 | that material) supplement the terms of this License with terms: 364 | 365 | a) Disclaiming warranty or limiting liability differently from the 366 | terms of sections 15 and 16 of this License; or 367 | 368 | b) Requiring preservation of specified reasonable legal notices or 369 | author attributions in that material or in the Appropriate Legal 370 | Notices displayed by works containing it; or 371 | 372 | c) Prohibiting misrepresentation of the origin of that material, or 373 | requiring that modified versions of such material be marked in 374 | reasonable ways as different from the original version; or 375 | 376 | d) Limiting the use for publicity purposes of names of licensors or 377 | authors of the material; or 378 | 379 | e) Declining to grant rights under trademark law for use of some 380 | trade names, trademarks, or service marks; or 381 | 382 | f) Requiring indemnification of licensors and authors of that 383 | material by anyone who conveys the material (or modified versions of 384 | it) with contractual assumptions of liability to the recipient, for 385 | any liability that these contractual assumptions directly impose on 386 | those licensors and authors. 387 | 388 | All other non-permissive additional terms are considered "further 389 | restrictions" within the meaning of section 10. If the Program as you 390 | received it, or any part of it, contains a notice stating that it is 391 | governed by this License along with a term that is a further 392 | restriction, you may remove that term. If a license document contains 393 | a further restriction but permits relicensing or conveying under this 394 | License, you may add to a covered work material governed by the terms 395 | of that license document, provided that the further restriction does 396 | not survive such relicensing or conveying. 397 | 398 | If you add terms to a covered work in accord with this section, you 399 | must place, in the relevant source files, a statement of the 400 | additional terms that apply to those files, or a notice indicating 401 | where to find the applicable terms. 402 | 403 | Additional terms, permissive or non-permissive, may be stated in the 404 | form of a separately written license, or stated as exceptions; 405 | the above requirements apply either way. 406 | 407 | 8. Termination. 408 | 409 | You may not propagate or modify a covered work except as expressly 410 | provided under this License. Any attempt otherwise to propagate or 411 | modify it is void, and will automatically terminate your rights under 412 | this License (including any patent licenses granted under the third 413 | paragraph of section 11). 414 | 415 | However, if you cease all violation of this License, then your 416 | license from a particular copyright holder is reinstated (a) 417 | provisionally, unless and until the copyright holder explicitly and 418 | finally terminates your license, and (b) permanently, if the copyright 419 | holder fails to notify you of the violation by some reasonable means 420 | prior to 60 days after the cessation. 421 | 422 | Moreover, your license from a particular copyright holder is 423 | reinstated permanently if the copyright holder notifies you of the 424 | violation by some reasonable means, this is the first time you have 425 | received notice of violation of this License (for any work) from that 426 | copyright holder, and you cure the violation prior to 30 days after 427 | your receipt of the notice. 428 | 429 | Termination of your rights under this section does not terminate the 430 | licenses of parties who have received copies or rights from you under 431 | this License. If your rights have been terminated and not permanently 432 | reinstated, you do not qualify to receive new licenses for the same 433 | material under section 10. 434 | 435 | 9. Acceptance Not Required for Having Copies. 436 | 437 | You are not required to accept this License in order to receive or 438 | run a copy of the Program. Ancillary propagation of a covered work 439 | occurring solely as a consequence of using peer-to-peer transmission 440 | to receive a copy likewise does not require acceptance. However, 441 | nothing other than this License grants you permission to propagate or 442 | modify any covered work. These actions infringe copyright if you do 443 | not accept this License. Therefore, by modifying or propagating a 444 | covered work, you indicate your acceptance of this License to do so. 445 | 446 | 10. Automatic Licensing of Downstream Recipients. 447 | 448 | Each time you convey a covered work, the recipient automatically 449 | receives a license from the original licensors, to run, modify and 450 | propagate that work, subject to this License. You are not responsible 451 | for enforcing compliance by third parties with this License. 452 | 453 | An "entity transaction" is a transaction transferring control of an 454 | organization, or substantially all assets of one, or subdividing an 455 | organization, or merging organizations. If propagation of a covered 456 | work results from an entity transaction, each party to that 457 | transaction who receives a copy of the work also receives whatever 458 | licenses to the work the party's predecessor in interest had or could 459 | give under the previous paragraph, plus a right to possession of the 460 | Corresponding Source of the work from the predecessor in interest, if 461 | the predecessor has it or can get it with reasonable efforts. 462 | 463 | You may not impose any further restrictions on the exercise of the 464 | rights granted or affirmed under this License. For example, you may 465 | not impose a license fee, royalty, or other charge for exercise of 466 | rights granted under this License, and you may not initiate litigation 467 | (including a cross-claim or counterclaim in a lawsuit) alleging that 468 | any patent claim is infringed by making, using, selling, offering for 469 | sale, or importing the Program or any portion of it. 470 | 471 | 11. Patents. 472 | 473 | A "contributor" is a copyright holder who authorizes use under this 474 | License of the Program or a work on which the Program is based. The 475 | work thus licensed is called the contributor's "contributor version". 476 | 477 | A contributor's "essential patent claims" are all patent claims 478 | owned or controlled by the contributor, whether already acquired or 479 | hereafter acquired, that would be infringed by some manner, permitted 480 | by this License, of making, using, or selling its contributor version, 481 | but do not include claims that would be infringed only as a 482 | consequence of further modification of the contributor version. For 483 | purposes of this definition, "control" includes the right to grant 484 | patent sublicenses in a manner consistent with the requirements of 485 | this License. 486 | 487 | Each contributor grants you a non-exclusive, worldwide, royalty-free 488 | patent license under the contributor's essential patent claims, to 489 | make, use, sell, offer for sale, import and otherwise run, modify and 490 | propagate the contents of its contributor version. 491 | 492 | In the following three paragraphs, a "patent license" is any express 493 | agreement or commitment, however denominated, not to enforce a patent 494 | (such as an express permission to practice a patent or covenant not to 495 | sue for patent infringement). To "grant" such a patent license to a 496 | party means to make such an agreement or commitment not to enforce a 497 | patent against the party. 498 | 499 | If you convey a covered work, knowingly relying on a patent license, 500 | and the Corresponding Source of the work is not available for anyone 501 | to copy, free of charge and under the terms of this License, through a 502 | publicly available network server or other readily accessible means, 503 | then you must either (1) cause the Corresponding Source to be so 504 | available, or (2) arrange to deprive yourself of the benefit of the 505 | patent license for this particular work, or (3) arrange, in a manner 506 | consistent with the requirements of this License, to extend the patent 507 | license to downstream recipients. "Knowingly relying" means you have 508 | actual knowledge that, but for the patent license, your conveying the 509 | covered work in a country, or your recipient's use of the covered work 510 | in a country, would infringe one or more identifiable patents in that 511 | country that you have reason to believe are valid. 512 | 513 | If, pursuant to or in connection with a single transaction or 514 | arrangement, you convey, or propagate by procuring conveyance of, a 515 | covered work, and grant a patent license to some of the parties 516 | receiving the covered work authorizing them to use, propagate, modify 517 | or convey a specific copy of the covered work, then the patent license 518 | you grant is automatically extended to all recipients of the covered 519 | work and works based on it. 520 | 521 | A patent license is "discriminatory" if it does not include within 522 | the scope of its coverage, prohibits the exercise of, or is 523 | conditioned on the non-exercise of one or more of the rights that are 524 | specifically granted under this License. You may not convey a covered 525 | work if you are a party to an arrangement with a third party that is 526 | in the business of distributing software, under which you make payment 527 | to the third party based on the extent of your activity of conveying 528 | the work, and under which the third party grants, to any of the 529 | parties who would receive the covered work from you, a discriminatory 530 | patent license (a) in connection with copies of the covered work 531 | conveyed by you (or copies made from those copies), or (b) primarily 532 | for and in connection with specific products or compilations that 533 | contain the covered work, unless you entered into that arrangement, 534 | or that patent license was granted, prior to 28 March 2007. 535 | 536 | Nothing in this License shall be construed as excluding or limiting 537 | any implied license or other defenses to infringement that may 538 | otherwise be available to you under applicable patent law. 539 | 540 | 12. No Surrender of Others' Freedom. 541 | 542 | If conditions are imposed on you (whether by court order, agreement or 543 | otherwise) that contradict the conditions of this License, they do not 544 | excuse you from the conditions of this License. If you cannot convey a 545 | covered work so as to satisfy simultaneously your obligations under this 546 | License and any other pertinent obligations, then as a consequence you may 547 | not convey it at all. For example, if you agree to terms that obligate you 548 | to collect a royalty for further conveying from those to whom you convey 549 | the Program, the only way you could satisfy both those terms and this 550 | License would be to refrain entirely from conveying the Program. 551 | 552 | 13. Use with the GNU Affero General Public License. 553 | 554 | Notwithstanding any other provision of this License, you have 555 | permission to link or combine any covered work with a work licensed 556 | under version 3 of the GNU Affero General Public License into a single 557 | combined work, and to convey the resulting work. The terms of this 558 | License will continue to apply to the part which is the covered work, 559 | but the special requirements of the GNU Affero General Public License, 560 | section 13, concerning interaction through a network will apply to the 561 | combination as such. 562 | 563 | 14. Revised Versions of this License. 564 | 565 | The Free Software Foundation may publish revised and/or new versions of 566 | the GNU General Public License from time to time. Such new versions will 567 | be similar in spirit to the present version, but may differ in detail to 568 | address new problems or concerns. 569 | 570 | Each version is given a distinguishing version number. If the 571 | Program specifies that a certain numbered version of the GNU General 572 | Public License "or any later version" applies to it, you have the 573 | option of following the terms and conditions either of that numbered 574 | version or of any later version published by the Free Software 575 | Foundation. If the Program does not specify a version number of the 576 | GNU General Public License, you may choose any version ever published 577 | by the Free Software Foundation. 578 | 579 | If the Program specifies that a proxy can decide which future 580 | versions of the GNU General Public License can be used, that proxy's 581 | public statement of acceptance of a version permanently authorizes you 582 | to choose that version for the Program. 583 | 584 | Later license versions may give you additional or different 585 | permissions. However, no additional obligations are imposed on any 586 | author or copyright holder as a result of your choosing to follow a 587 | later version. 588 | 589 | 15. Disclaimer of Warranty. 590 | 591 | THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY 592 | APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT 593 | HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY 594 | OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, 595 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 596 | PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM 597 | IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF 598 | ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 599 | 600 | 16. Limitation of Liability. 601 | 602 | IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING 603 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS 604 | THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY 605 | GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE 606 | USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF 607 | DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD 608 | PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), 609 | EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF 610 | SUCH DAMAGES. 611 | 612 | 17. Interpretation of Sections 15 and 16. 613 | 614 | If the disclaimer of warranty and limitation of liability provided 615 | above cannot be given local legal effect according to their terms, 616 | reviewing courts shall apply local law that most closely approximates 617 | an absolute waiver of all civil liability in connection with the 618 | Program, unless a warranty or assumption of liability accompanies a 619 | copy of the Program in return for a fee. 620 | 621 | END OF TERMS AND CONDITIONS 622 | 623 | How to Apply These Terms to Your New Programs 624 | 625 | If you develop a new program, and you want it to be of the greatest 626 | possible use to the public, the best way to achieve this is to make it 627 | free software which everyone can redistribute and change under these terms. 628 | 629 | To do so, attach the following notices to the program. It is safest 630 | to attach them to the start of each source file to most effectively 631 | state the exclusion of warranty; and each file should have at least 632 | the "copyright" line and a pointer to where the full notice is found. 633 | 634 | {one line to give the program's name and a brief idea of what it does.} 635 | Copyright (C) {year} {name of author} 636 | 637 | This program is free software: you can redistribute it and/or modify 638 | it under the terms of the GNU General Public License as published by 639 | the Free Software Foundation, either version 3 of the License, or 640 | (at your option) any later version. 641 | 642 | This program is distributed in the hope that it will be useful, 643 | but WITHOUT ANY WARRANTY; without even the implied warranty of 644 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 645 | GNU General Public License for more details. 646 | 647 | You should have received a copy of the GNU General Public License 648 | along with this program. If not, see . 649 | 650 | Also add information on how to contact you by electronic and paper mail. 651 | 652 | If the program does terminal interaction, make it output a short 653 | notice like this when it starts in an interactive mode: 654 | 655 | {project} Copyright (C) {year} {fullname} 656 | This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. 657 | This is free software, and you are welcome to redistribute it 658 | under certain conditions; type `show c' for details. 659 | 660 | The hypothetical commands `show w' and `show c' should show the appropriate 661 | parts of the General Public License. Of course, your program's commands 662 | might be different; for a GUI interface, you would use an "about box". 663 | 664 | You should also get your employer (if you work as a programmer) or school, 665 | if any, to sign a "copyright disclaimer" for the program, if necessary. 666 | For more information on this, and how to apply and follow the GNU GPL, see 667 | . 668 | 669 | The GNU General Public License does not permit incorporating your program 670 | into proprietary programs. If your program is a subroutine library, you 671 | may consider it more useful to permit linking proprietary applications with 672 | the library. If this is what you want to do, use the GNU Lesser General 673 | Public License instead of this License. But first, please read 674 | . 675 | 676 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | #monkeyServer.sh 2 | 3 | ![Monkey Web Server](https://i.imgur.com/jiQdi6e.png) 4 | 5 | monkeyServer.sh is a simple shell script made to install a full web stack at low end boxes in about 5 minutes. It is built on top of [Monkey Web Server](http://monkey-project.com/), a really simple but feature rich web server. Monkey is really fast and stable, increadibly small and light on resources. 6 | 7 | ## WHAT IS INCLUDED ## 8 | monkeyServer.sh comes in two flavors: 9 | 10 | ### DEFAULT FLAVOR ### 11 | 1. Monkey Web Server 12 | 2. PHP5-FPM 13 | 3. MariaDB 14 | 4. ConfigServer Firewall (CSF+LFD) 15 | 5. Adminer 16 | 17 | **Running Process and Resource Usage for the Default Flavor:** 18 | 19 | ![Running Services](http://i.imgur.com/72ABGNM.png) 20 | ![Memory Usage](http://i.imgur.com/fl2gBno.png) 21 | ![SolusVM resources](http://i.imgur.com/lwnb8CX.png) 22 | 23 | ### NOSQL FLAVOR ### 24 | This version don't include MariaDB or Adminer. Note that if you are using SQLite or any other database method that use files stored at your web root (like JSON files) you should configure the mandril plugin to deny access to the database files. This isn't built by monkeyServer.sh by default because we can't preview the filename patterns used by the users. Please refer to the [documentation](http://monkey-project.com/documentation/1.5/). 25 | 26 | **Running Process and Resource Usage for the NoSQL flavor:** 27 | 28 | ![Running Process](http://i.imgur.com/5bLFTrS.png) 29 | ![Memory Usage](http://i.imgur.com/oR0xjSJ.png) 30 | ![SolusVM resources](http://i.imgur.com/afAYwfz.png) 31 | 32 | ## WHAT MODULES IS INCLUDED IN THE INSTALLATION ## 33 | monkeyServer.sh will build your stack with a very small set of PHP5 and Monkey Web Server modules. This should be enough to 99% of the use cases. Bellow you will find a full list of the modules. 34 | 35 | ### MONKEY WEB SERVER MODULES ### 36 | 1. auth 37 | 2. liana 38 | 4. logger 39 | 5. fastcgi 40 | 6. dirlisting 41 | 7. auth 42 | 8. mbedtls 43 | 10. mandril 44 | 11. cheetah 45 | 12. reverse_proxy 46 | 47 | ### PHP MODULES ### 48 | 1. mcrypt 49 | 2. mysqlnd 50 | 3. sqlite 51 | 4. pear 52 | 5. gd 53 | 6. xml-serializer 54 | 55 | ## MINIMUM REQUIREMENTS ## 56 | 1. RAM: 128MB (or just 64MB if you use the noSQL option) 57 | 2. HDD: 2GB 58 | 3. CPU: X86, X86_64 or ARM. 59 | 4. Distro: by now, only Debian Stable is supported 60 | 61 | P.S.: You can, actually, cut the RAM requirement in a half. BUT, for the default flavor, this can be equal to really boring problems with MariaDB if you use InnoDB. So, we will say that minimum memory requirement to have a realiable server operation. Using less than that should work (with PHP-FPM tweaking you can run the noSQL with 16-24MB and the default with 32-64MB if you tweak MariaDB too) but is not recommended. In the near future, the embedded version should require only 8MB and the tweaks for PHP-FPM and MariaDB should be integrated. 62 | 63 | ## HOW TO INSTALL ## 64 | Just run `/usr/bin/env bash <((wget -qO - https://raw.githubusercontent.com/alexandreteles/monkeyServer/master/monkeyServer.sh))` as root and follow the script instructions. 65 | 66 | ## HOW TO OBTAIN SUPPORT ## 67 | At Low End Talk [official thread](http://lowendtalk.com/discussion/39893/debian-monkeyserver-sh-a-script-to-install-a-full-web-stack-at-lebs-in-5-minutes) or at the [issue page](https://github.com/alexandreteles/monkeyServer/issues) of the project at GitHub. 68 | 69 | ## WHAT IS PLANNED ## 70 | 1. A menu based installation (this will join the default and the noSQL versions); 71 | 2. A enableIPv6.sh script; 72 | 3. App installation capabilities; 73 | 4. FTP server installation; 74 | 5. Embedded version (to require only 32MB of RAM) 75 | 76 | ## LEARN MORE ## 77 | 1. Take a look at this (a bit outdated) [presentation](http://www.slideshare.net/startechconf/eduardo-silva-monkey-httpserver-everywhere) about Monkey Web Server 78 | 2. Read the official Monkey Web Server [documentation](http://monkey-project.com/documentation/1.5/). It's really handy. 79 | 3. Learn about the reverse_proxy module in Monkey Web Server reading [this](http://savita92.wordpress.com/2014/04/06/reverse-proxy-and-its-support-by-monkey-server/) article. 80 | 4. Learn how to setup the reverse_proxy reading [this](http://nikolanikov.wordpress.com/2013/08/14/monkey-proxy-reverse-plugin-preview/) tutorial. 81 | 82 | ## RESOURCES ## 83 | GitHub: [https://github.com/alexandreteles/monkeyServer](https://github.com/alexandreteles/monkeyServer) 84 | -------------------------------------------------------------------------------- /includes/conf/embedded/monkey.conf: -------------------------------------------------------------------------------- 1 | # Monkey HTTP Daemon - Configuration 2 | # ================================== 3 | # These are the main variables and their descriptions, defined in respect 4 | # to the configuration of the different types of directives. 5 | 6 | [SERVER] 7 | # Port: 8 | # ----- 9 | # Port is the number of the door in which Monkey will be listened through 10 | # connections and petitions. This number can have any value between 1 and 11 | # 65535. If the specified number is less than or equal to 1024, only root 12 | # superuser's owned process will be able to be established as a connection. 13 | 14 | Port 80 15 | 16 | # Listen: 17 | # ------- 18 | # The Listen directive restricts to the network interface from where Monkey 19 | # will be listening for incoming connections. If you want to restrict to the 20 | # lookback interface, for IPv4 you can set '127.0.0.1' or the value '::1' in 21 | # case of IPv6, e.g: 22 | # 23 | # Listen 127.0.0.1 24 | 25 | Listen 0.0.0.0 26 | 27 | # Workers: 28 | # -------- 29 | # Monkey launches threads to attend clients; each worker thread is capable 30 | # of attending more than one client request at one time. The amount of 31 | # clients that can be handled by each thread is calculated using the 32 | # number of file descriptors allowed by the system. If this variable 33 | # is set to 0 monkey will launch one thread per processor. 34 | 35 | Workers 0 36 | 37 | # Timeout: 38 | # -------- 39 | # The largest span of time, expressed in seconds, during which you should 40 | # wait to receive the information or waiting time for the remote host to 41 | # accept an answer. (Timeout > 0) 42 | 43 | Timeout 15 44 | 45 | # PidFile: 46 | # -------- 47 | # File where the server guards the process number when starting. 48 | # Note that the filename will have the port number appended to it. 49 | 50 | PidFile /usr/local/run/monkey/monkey.pid 51 | 52 | # UserDir: 53 | # -------- 54 | # Directory name for users home (/~user). 55 | 56 | UserDir public_html 57 | 58 | # Indexfile: 59 | # ---------- 60 | # Number of the initial file of aperture when calling a directory. 61 | 62 | Indexfile index.html index.htm index.php 63 | 64 | # HideVersion: 65 | # ------------ 66 | # For security reasons, sometimes people want to hide the version of his 67 | # own webserver to clients (values on/off). 68 | 69 | HideVersion on 70 | 71 | 72 | # Resume: 73 | # ------- 74 | # Allow clients to request files by ranges (values on/off). 75 | 76 | Resume on 77 | 78 | # User: 79 | # ----- 80 | # If you want the webserver to run as a process of a defined user, you can 81 | # define it in this variable. For the change of user to work, it's necessary 82 | # to execute Monkey with root privileges. If it's started by a user that 83 | # that doesn't have root privileges, this variable will be omitted. 84 | 85 | User monkey 86 | 87 | # ----------------- 88 | # ADVANCED CONFIG 89 | # ----------------- 90 | # Just change the next variables if you know what are you doing. 91 | 92 | # KeepAlive: 93 | # ---------- 94 | # Allow persistent connections. (on/off) 95 | 96 | KeepAlive on 97 | 98 | # KeepAliveTimeout 99 | # ---------------- 100 | # Number of seconds to wait for the next request in a persistent 101 | # connection (value > 0). 102 | 103 | KeepAliveTimeout 5 104 | 105 | # MaxKeepAliveRequest: 106 | # -------------------- 107 | # Maximum number of requests per connection. (value > 0) 108 | 109 | MaxKeepAliveRequest 1000 110 | 111 | # MaxRequestSize: 112 | # --------------- 113 | # When a request arrives, Monkey allocs a 'chunk' of memory space 114 | # to receive the incoming data. As many times the incoming data 115 | # size is undeterminated, Monkey increases the buffer as required. This 116 | # variable defines the maximum size that the buffer can grow in terms 117 | # of KB. Example: defining 'MaxRequestSize 32' means 32 Kilobytes. 118 | # The value defined must be greater than zero. Default value defined 119 | # is 32. 120 | 121 | MaxRequestSize 32 122 | 123 | # SymLink: 124 | # -------- 125 | # Allow request to symbolic link files. 126 | 127 | SymLink On 128 | 129 | # TransportLayer: 130 | # --------------- 131 | # Define which network I/O plugin provides the transport layer. The 132 | # value of the key belongs to the shortname of the plugin. Make sure 133 | # the plugin is loaded by 'plugins.load' file. 134 | # 135 | # HTTP is provided by liana 136 | # HTTPS is provided by polarssl 137 | 138 | TransportLayer liana 139 | 140 | # DefaultMimeType: 141 | # ---------------- 142 | # If a static content is requested and it does not contain a known extension, 143 | # Monkey will send the mime type specified on this directive. 144 | 145 | DefaultMimeType text/plain 146 | 147 | # FDT: 148 | # ---- 149 | # The File Descriptor Table (FDT) it's an internal mechanism to share open 150 | # file descriptors under specific threads and virtual host context. When 151 | # enabled, it helps to reduce the number of opened file descriptors for the 152 | # same resource and the number of required system calls to open and close 153 | # files. 154 | # 155 | # The overhead in memory of this feature is around ~5KB per worker. 156 | 157 | FDT On 158 | 159 | -------------------------------------------------------------------------------- /includes/conf/monkey.conf: -------------------------------------------------------------------------------- 1 | # Monkey HTTP Daemon - Configuration 2 | # ================================== 3 | # These are the main variables and their descriptions, defined in respect 4 | # to the configuration of the different types of directives. 5 | 6 | [SERVER] 7 | # Port: 8 | # ----- 9 | # Port is the number of the door in which Monkey will be listened through 10 | # connections and petitions. This number can have any value between 1 and 11 | # 65535. If the specified number is less than or equal to 1024, only root 12 | # superuser's owned process will be able to be established as a connection. 13 | 14 | Port 80 15 | 16 | # Listen: 17 | # ------- 18 | # The Listen directive restricts to the network interface from where Monkey 19 | # will be listening for incoming connections. If you want to restrict to the 20 | # lookback interface, for IPv4 you can set '127.0.0.1' or the value '::1' in 21 | # case of IPv6, e.g: 22 | 23 | Listen 0.0.0.0 24 | 25 | # Workers: 26 | # -------- 27 | # Monkey launches threads to attend clients; each worker thread is capable 28 | # of attending more than one client request at one time. The amount of 29 | # clients that can be handled by each thread is calculated using the 30 | # number of file descriptors allowed by the system. If this variable 31 | # is set to 0 monkey will launch one thread per processor. 32 | 33 | Workers 4 34 | 35 | # Timeout: 36 | # -------- 37 | # The largest span of time, expressed in seconds, during which you should 38 | # wait to receive the information or waiting time for the remote host to 39 | # accept an answer. (Timeout > 0) 40 | 41 | Timeout 15 42 | 43 | # PidFile: 44 | # -------- 45 | # File where the server guards the process number when starting. 46 | # Note that the filename will have the port number appended to it. 47 | 48 | PidFile /usr/local/run/monkey/monkey.pid 49 | 50 | # UserDir: 51 | # -------- 52 | # Directory name for users home (/~user). 53 | 54 | UserDir public_html 55 | 56 | # Indexfile: 57 | # ---------- 58 | # Number of the initial file of aperture when calling a directory. 59 | 60 | Indexfile index.html index.htm index.php 61 | 62 | # HideVersion: 63 | # ------------ 64 | # For security reasons, sometimes people want to hide the version of his 65 | # own webserver to clients (values on/off). 66 | 67 | HideVersion on 68 | 69 | 70 | # Resume: 71 | # ------- 72 | # Allow clients to request files by ranges (values on/off). 73 | 74 | Resume on 75 | 76 | # User: 77 | # ----- 78 | # If you want the webserver to run as a process of a defined user, you can 79 | # define it in this variable. For the change of user to work, it's necessary 80 | # to execute Monkey with root privileges. If it's started by a user that 81 | # that doesn't have root privileges, this variable will be omitted. 82 | 83 | User monkey 84 | 85 | # ----------------- 86 | # ADVANCED CONFIG 87 | # ----------------- 88 | # Just change the next variables if you know what are you doing. 89 | 90 | # KeepAlive: 91 | # ---------- 92 | # Allow persistent connections. (on/off) 93 | 94 | KeepAlive on 95 | 96 | # KeepAliveTimeout 97 | # ---------------- 98 | # Number of seconds to wait for the next request in a persistent 99 | # connection (value > 0). 100 | 101 | KeepAliveTimeout 15 102 | 103 | # MaxKeepAliveRequest: 104 | # -------------------- 105 | # Maximum number of requests per connection. (value > 0) 106 | 107 | MaxKeepAliveRequest 10000 108 | 109 | # MaxRequestSize: 110 | # --------------- 111 | # When a request arrives, Monkey allocs a 'chunk' of memory space 112 | # to receive the incoming data. As many times the incoming data 113 | # size is undeterminated, Monkey increases the buffer as required. This 114 | # variable defines the maximum size that the buffer can grow in terms 115 | # of KB. Example: defining 'MaxRequestSize 32' means 32 Kilobytes. 116 | # The value defined must be greater than zero. Default value defined 117 | # is 32. 118 | 119 | MaxRequestSize 8000 120 | 121 | # SymLink: 122 | # -------- 123 | # Allow request to symbolic link files. 124 | 125 | SymLink On 126 | 127 | # TransportLayer: 128 | # --------------- 129 | # Define which network I/O plugin provides the transport layer. The 130 | # value of the key belongs to the shortname of the plugin. Make sure 131 | # the plugin is loaded by 'plugins.load' file. 132 | # 133 | # HTTP is provided by liana 134 | # HTTPS is provided by polarssl 135 | 136 | TransportLayer liana 137 | 138 | # DefaultMimeType: 139 | # ---------------- 140 | # If a static content is requested and it does not contain a known extension, 141 | # Monkey will send the mime type specified on this directive. 142 | 143 | DefaultMimeType text/plain 144 | 145 | # FDT: 146 | # ---- 147 | # The File Descriptor Table (FDT) it's an internal mechanism to share open 148 | # file descriptors under specific threads and virtual host context. When 149 | # enabled, it helps to reduce the number of opened file descriptors for the 150 | # same resource and the number of required system calls to open and close 151 | # files. 152 | # 153 | # The overhead in memory of this feature is around ~5KB per worker. 154 | 155 | FDT On 156 | -------------------------------------------------------------------------------- /includes/conf/monkeyIPv6.conf: -------------------------------------------------------------------------------- 1 | # Monkey HTTP Daemon - Configuration 2 | # ================================== 3 | # These are the main variables and their descriptions, defined in respect 4 | # to the configuration of the different types of directives. 5 | 6 | [SERVER] 7 | # Port: 8 | # ----- 9 | # Port is the number of the door in which Monkey will be listened through 10 | # connections and petitions. This number can have any value between 1 and 11 | # 65535. If the specified number is less than or equal to 1024, only root 12 | # superuser's owned process will be able to be established as a connection. 13 | 14 | Port 80 15 | 16 | # Listen: 17 | # ------- 18 | # The Listen directive restricts to the network interface from where Monkey 19 | # will be listening for incoming connections. If you want to restrict to the 20 | # lookback interface, for IPv4 you can set '127.0.0.1' or the value '::1' in 21 | # case of IPv6, e.g: 22 | 23 | Listen :: 24 | 25 | # Workers: 26 | # -------- 27 | # Monkey launches threads to attend clients; each worker thread is capable 28 | # of attending more than one client request at one time. The amount of 29 | # clients that can be handled by each thread is calculated using the 30 | # number of file descriptors allowed by the system. If this variable 31 | # is set to 0 monkey will launch one thread per processor. 32 | 33 | Workers 4 34 | 35 | # Timeout: 36 | # -------- 37 | # The largest span of time, expressed in seconds, during which you should 38 | # wait to receive the information or waiting time for the remote host to 39 | # accept an answer. (Timeout > 0) 40 | 41 | Timeout 15 42 | 43 | # PidFile: 44 | # -------- 45 | # File where the server guards the process number when starting. 46 | # Note that the filename will have the port number appended to it. 47 | 48 | PidFile /usr/local/run/monkey/monkeyIPv6.pid 49 | 50 | # UserDir: 51 | # -------- 52 | # Directory name for users home (/~user). 53 | 54 | UserDir public_html 55 | 56 | # Indexfile: 57 | # ---------- 58 | # Number of the initial file of aperture when calling a directory. 59 | 60 | Indexfile index.html index.htm index.php 61 | 62 | # HideVersion: 63 | # ------------ 64 | # For security reasons, sometimes people want to hide the version of his 65 | # own webserver to clients (values on/off). 66 | 67 | HideVersion on 68 | 69 | 70 | # Resume: 71 | # ------- 72 | # Allow clients to request files by ranges (values on/off). 73 | 74 | Resume on 75 | 76 | # User: 77 | # ----- 78 | # If you want the webserver to run as a process of a defined user, you can 79 | # define it in this variable. For the change of user to work, it's necessary 80 | # to execute Monkey with root privileges. If it's started by a user that 81 | # that doesn't have root privileges, this variable will be omitted. 82 | 83 | User monkey 84 | 85 | # ----------------- 86 | # ADVANCED CONFIG 87 | # ----------------- 88 | # Just change the next variables if you know what are you doing. 89 | 90 | # KeepAlive: 91 | # ---------- 92 | # Allow persistent connections. (on/off) 93 | 94 | KeepAlive on 95 | 96 | # KeepAliveTimeout 97 | # ---------------- 98 | # Number of seconds to wait for the next request in a persistent 99 | # connection (value > 0). 100 | 101 | KeepAliveTimeout 15 102 | 103 | # MaxKeepAliveRequest: 104 | # -------------------- 105 | # Maximum number of requests per connection. (value > 0) 106 | 107 | MaxKeepAliveRequest 10000 108 | 109 | # MaxRequestSize: 110 | # --------------- 111 | # When a request arrives, Monkey allocs a 'chunk' of memory space 112 | # to receive the incoming data. As many times the incoming data 113 | # size is undeterminated, Monkey increases the buffer as required. This 114 | # variable defines the maximum size that the buffer can grow in terms 115 | # of KB. Example: defining 'MaxRequestSize 32' means 32 Kilobytes. 116 | # The value defined must be greater than zero. Default value defined 117 | # is 32. 118 | 119 | MaxRequestSize 8000 120 | 121 | # SymLink: 122 | # -------- 123 | # Allow request to symbolic link files. 124 | 125 | SymLink On 126 | 127 | # TransportLayer: 128 | # --------------- 129 | # Define which network I/O plugin provides the transport layer. The 130 | # value of the key belongs to the shortname of the plugin. Make sure 131 | # the plugin is loaded by 'plugins.load' file. 132 | # 133 | # HTTP is provided by liana 134 | # HTTPS is provided by polarssl 135 | 136 | TransportLayer liana 137 | 138 | # DefaultMimeType: 139 | # ---------------- 140 | # If a static content is requested and it does not contain a known extension, 141 | # Monkey will send the mime type specified on this directive. 142 | 143 | DefaultMimeType text/plain 144 | 145 | # FDT: 146 | # ---- 147 | # The File Descriptor Table (FDT) it's an internal mechanism to share open 148 | # file descriptors under specific threads and virtual host context. When 149 | # enabled, it helps to reduce the number of opened file descriptors for the 150 | # same resource and the number of required system calls to open and close 151 | # files. 152 | # 153 | # The overhead in memory of this feature is around ~5KB per worker. 154 | 155 | FDT On 156 | -------------------------------------------------------------------------------- /includes/init.d/monkey: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | PATH=/sbin:/bin:/usr/sbin:/usr/bin 3 | DAEMON=/usr/local/bin/monkey 4 | NAME=monkey 5 | DESC="Monkey HTTP Server" 6 | OPTS="--daemon" 7 | case "$1" in 8 | start) 9 | echo -n "Starting $DESC: " 10 | start-stop-daemon --start -x "$DAEMON" -- $OPTS 11 | echo "$NAME." 12 | ;; 13 | stop) 14 | echo -n "Stopping $DESC: " 15 | start-stop-daemon --stop -x "$DAEMON" 16 | echo "$NAME." 17 | ;; 18 | restart|force-reload) 19 | echo -n "Restarting $DESC: " 20 | start-stop-daemon --stop -x "$DAEMON" 21 | sleep 1 22 | start-stop-daemon --start -x "$DAEMON" -- $OPTS 23 | echo "$NAME." 24 | ;; 25 | *) 26 | N=/etc/init.d/$NAME 27 | echo "Usage: $N {start|stop|restart|force-reload}" >&2 28 | exit 1 29 | ;; 30 | esac 31 | exit 0 32 | -------------------------------------------------------------------------------- /includes/init.d/monkeyIPv6: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | PATH=/sbin:/bin:/usr/sbin:/usr/bin 3 | DAEMON=/usr/local/bin/monkey 4 | NAME=monkeyIPv6 5 | DESC="Monkey HTTP Server" 6 | OPTS="--daemon --serverconf=/usr/local/etc/monkey/monkeyIPv6.conf" 7 | case "$1" in 8 | start) 9 | echo -n "Starting $DESC: " 10 | start-stop-daemon --start -x "$DAEMON" -- $OPTS 11 | echo "$NAME." 12 | ;; 13 | stop) 14 | echo -n "Stopping $DESC: " 15 | start-stop-daemon --stop -x "$DAEMON" 16 | echo "$NAME." 17 | ;; 18 | restart|force-reload) 19 | echo -n "Restarting $DESC: " 20 | start-stop-daemon --stop -x "$DAEMON" 21 | sleep 1 22 | start-stop-daemon --start -x "$DAEMON" -- $OPTS 23 | echo "$NAME." 24 | ;; 25 | *) 26 | N=/etc/init.d/$NAME 27 | echo "Usage: $N {start|stop|restart|force-reload}" >&2 28 | exit 1 29 | ;; 30 | esac 31 | exit 0 32 | -------------------------------------------------------------------------------- /includes/php5/www.conf: -------------------------------------------------------------------------------- 1 | ; Start a new pool named 'www'. 2 | ; the variable $pool can we used in any directive and will be replaced by the 3 | ; pool name ('www' here) 4 | [www] 5 | 6 | ; Per pool prefix 7 | ; It only applies on the following directives: 8 | ; - 'slowlog' 9 | ; - 'listen' (unixsocket) 10 | ; - 'chroot' 11 | ; - 'chdir' 12 | ; - 'php_values' 13 | ; - 'php_admin_values' 14 | ; When not set, the global prefix (or /usr) applies instead. 15 | ; Note: This directive can also be relative to the global prefix. 16 | ; Default Value: none 17 | ;prefix = /path/to/pools/$pool 18 | 19 | ; Unix user/group of processes 20 | ; Note: The user is mandatory. If the group is not set, the default user's group 21 | ; will be used. 22 | user = monkey 23 | group = monkey 24 | 25 | ; The address on which to accept FastCGI requests. 26 | ; Valid syntaxes are: 27 | ; 'ip.add.re.ss:port' - to listen on a TCP socket to a specific address on 28 | ; a specific port; 29 | ; 'port' - to listen on a TCP socket to all addresses on a 30 | ; specific port; 31 | ; '/path/to/unix/socket' - to listen on a unix socket. 32 | ; Note: This value is mandatory. 33 | listen = /var/run/php5-fpm.sock 34 | 35 | ; Set listen(2) backlog. 36 | ; Default Value: 128 (-1 on FreeBSD and OpenBSD) 37 | ;listen.backlog = 128 38 | 39 | ; Set permissions for unix socket, if one is used. In Linux, read/write 40 | ; permissions must be set in order to allow connections from a web server. Many 41 | ; BSD-derived systems allow connections regardless of permissions. 42 | ; Default Values: user and group are set as the running user 43 | ; mode is set to 0660 44 | listen.owner = monkey 45 | listen.group = monkey 46 | listen.mode = 0660 47 | 48 | ; List of ipv4 addresses of FastCGI clients which are allowed to connect. 49 | ; Equivalent to the FCGI_WEB_SERVER_ADDRS environment variable in the original 50 | ; PHP FCGI (5.2.2+). Makes sense only with a tcp listening socket. Each address 51 | ; must be separated by a comma. If this value is left blank, connections will be 52 | ; accepted from any ip address. 53 | ; Default Value: any 54 | ;listen.allowed_clients = 127.0.0.1 55 | 56 | ; Specify the nice(2) priority to apply to the pool processes (only if set) 57 | ; The value can vary from -19 (highest priority) to 20 (lower priority) 58 | ; Note: - It will only work if the FPM master process is launched as root 59 | ; - The pool processes will inherit the master process priority 60 | ; unless it specified otherwise 61 | ; Default Value: no set 62 | ; process.priority = -19 63 | 64 | ; Choose how the process manager will control the number of child processes. 65 | ; Possible Values: 66 | ; static - a fixed number (pm.max_children) of child processes; 67 | ; dynamic - the number of child processes are set dynamically based on the 68 | ; following directives. With this process management, there will be 69 | ; always at least 1 children. 70 | ; pm.max_children - the maximum number of children that can 71 | ; be alive at the same time. 72 | ; pm.start_servers - the number of children created on startup. 73 | ; pm.min_spare_servers - the minimum number of children in 'idle' 74 | ; state (waiting to process). If the number 75 | ; of 'idle' processes is less than this 76 | ; number then some children will be created. 77 | ; pm.max_spare_servers - the maximum number of children in 'idle' 78 | ; state (waiting to process). If the number 79 | ; of 'idle' processes is greater than this 80 | ; number then some children will be killed. 81 | ; ondemand - no children are created at startup. Children will be forked when 82 | ; new requests will connect. The following parameter are used: 83 | ; pm.max_children - the maximum number of children that 84 | ; can be alive at the same time. 85 | ; pm.process_idle_timeout - The number of seconds after which 86 | ; an idle process will be killed. 87 | ; Note: This value is mandatory. 88 | pm = dynamic 89 | 90 | ; The number of child processes to be created when pm is set to 'static' and the 91 | ; maximum number of child processes when pm is set to 'dynamic' or 'ondemand'. 92 | ; This value sets the limit on the number of simultaneous requests that will be 93 | ; served. Equivalent to the ApacheMaxClients directive with mpm_prefork. 94 | ; Equivalent to the PHP_FCGI_CHILDREN environment variable in the original PHP 95 | ; CGI. The below defaults are based on a server without much resources. Don't 96 | ; forget to tweak pm.* to fit your needs. 97 | ; Note: Used when pm is set to 'static', 'dynamic' or 'ondemand' 98 | ; Note: This value is mandatory. 99 | pm.max_children = 5 100 | 101 | ; The number of child processes created on startup. 102 | ; Note: Used only when pm is set to 'dynamic' 103 | ; Default Value: min_spare_servers + (max_spare_servers - min_spare_servers) / 2 104 | pm.start_servers = 2 105 | 106 | ; The desired minimum number of idle server processes. 107 | ; Note: Used only when pm is set to 'dynamic' 108 | ; Note: Mandatory when pm is set to 'dynamic' 109 | pm.min_spare_servers = 1 110 | 111 | ; The desired maximum number of idle server processes. 112 | ; Note: Used only when pm is set to 'dynamic' 113 | ; Note: Mandatory when pm is set to 'dynamic' 114 | pm.max_spare_servers = 3 115 | 116 | ; The number of seconds after which an idle process will be killed. 117 | ; Note: Used only when pm is set to 'ondemand' 118 | ; Default Value: 10s 119 | ;pm.process_idle_timeout = 10s; 120 | 121 | ; The number of requests each child process should execute before respawning. 122 | ; This can be useful to work around memory leaks in 3rd party libraries. For 123 | ; endless request processing specify '0'. Equivalent to PHP_FCGI_MAX_REQUESTS. 124 | ; Default Value: 0 125 | ;pm.max_requests = 500 126 | 127 | ; The URI to view the FPM status page. If this value is not set, no URI will be 128 | ; recognized as a status page. It shows the following informations: 129 | ; pool - the name of the pool; 130 | ; process manager - static, dynamic or ondemand; 131 | ; start time - the date and time FPM has started; 132 | ; start since - number of seconds since FPM has started; 133 | ; accepted conn - the number of request accepted by the pool; 134 | ; listen queue - the number of request in the queue of pending 135 | ; connections (see backlog in listen(2)); 136 | ; max listen queue - the maximum number of requests in the queue 137 | ; of pending connections since FPM has started; 138 | ; listen queue len - the size of the socket queue of pending connections; 139 | ; idle processes - the number of idle processes; 140 | ; active processes - the number of active processes; 141 | ; total processes - the number of idle + active processes; 142 | ; max active processes - the maximum number of active processes since FPM 143 | ; has started; 144 | ; max children reached - number of times, the process limit has been reached, 145 | ; when pm tries to start more children (works only for 146 | ; pm 'dynamic' and 'ondemand'); 147 | ; Value are updated in real time. 148 | ; Example output: 149 | ; pool: www 150 | ; process manager: static 151 | ; start time: 01/Jul/2011:17:53:49 +0200 152 | ; start since: 62636 153 | ; accepted conn: 190460 154 | ; listen queue: 0 155 | ; max listen queue: 1 156 | ; listen queue len: 42 157 | ; idle processes: 4 158 | ; active processes: 11 159 | ; total processes: 15 160 | ; max active processes: 12 161 | ; max children reached: 0 162 | ; 163 | ; By default the status page output is formatted as text/plain. Passing either 164 | ; 'html', 'xml' or 'json' in the query string will return the corresponding 165 | ; output syntax. Example: 166 | ; http://www.foo.bar/status 167 | ; http://www.foo.bar/status?json 168 | ; http://www.foo.bar/status?html 169 | ; http://www.foo.bar/status?xml 170 | ; 171 | ; By default the status page only outputs short status. Passing 'full' in the 172 | ; query string will also return status for each pool process. 173 | ; Example: 174 | ; http://www.foo.bar/status?full 175 | ; http://www.foo.bar/status?json&full 176 | ; http://www.foo.bar/status?html&full 177 | ; http://www.foo.bar/status?xml&full 178 | ; The Full status returns for each process: 179 | ; pid - the PID of the process; 180 | ; state - the state of the process (Idle, Running, ...); 181 | ; start time - the date and time the process has started; 182 | ; start since - the number of seconds since the process has started; 183 | ; requests - the number of requests the process has served; 184 | ; request duration - the duration in µs of the requests; 185 | ; request method - the request method (GET, POST, ...); 186 | ; request URI - the request URI with the query string; 187 | ; content length - the content length of the request (only with POST); 188 | ; user - the user (PHP_AUTH_USER) (or '-' if not set); 189 | ; script - the main script called (or '-' if not set); 190 | ; last request cpu - the %cpu the last request consumed 191 | ; it's always 0 if the process is not in Idle state 192 | ; because CPU calculation is done when the request 193 | ; processing has terminated; 194 | ; last request memory - the max amount of memory the last request consumed 195 | ; it's always 0 if the process is not in Idle state 196 | ; because memory calculation is done when the request 197 | ; processing has terminated; 198 | ; If the process is in Idle state, then informations are related to the 199 | ; last request the process has served. Otherwise informations are related to 200 | ; the current request being served. 201 | ; Example output: 202 | ; ************************ 203 | ; pid: 31330 204 | ; state: Running 205 | ; start time: 01/Jul/2011:17:53:49 +0200 206 | ; start since: 63087 207 | ; requests: 12808 208 | ; request duration: 1250261 209 | ; request method: GET 210 | ; request URI: /test_mem.php?N=10000 211 | ; content length: 0 212 | ; user: - 213 | ; script: /home/fat/web/docs/php/test_mem.php 214 | ; last request cpu: 0.00 215 | ; last request memory: 0 216 | ; 217 | ; Note: There is a real-time FPM status monitoring sample web page available 218 | ; It's available in: ${prefix}/share/fpm/status.html 219 | ; 220 | ; Note: The value must start with a leading slash (/). The value can be 221 | ; anything, but it may not be a good idea to use the .php extension or it 222 | ; may conflict with a real PHP file. 223 | ; Default Value: not set 224 | ;pm.status_path = /status 225 | 226 | ; The ping URI to call the monitoring page of FPM. If this value is not set, no 227 | ; URI will be recognized as a ping page. This could be used to test from outside 228 | ; that FPM is alive and responding, or to 229 | ; - create a graph of FPM availability (rrd or such); 230 | ; - remove a server from a group if it is not responding (load balancing); 231 | ; - trigger alerts for the operating team (24/7). 232 | ; Note: The value must start with a leading slash (/). The value can be 233 | ; anything, but it may not be a good idea to use the .php extension or it 234 | ; may conflict with a real PHP file. 235 | ; Default Value: not set 236 | ;ping.path = /ping 237 | 238 | ; This directive may be used to customize the response of a ping request. The 239 | ; response is formatted as text/plain with a 200 response code. 240 | ; Default Value: pong 241 | ;ping.response = pong 242 | 243 | ; The access log file 244 | ; Default: not set 245 | ;access.log = log/$pool.access.log 246 | 247 | ; The access log format. 248 | ; The following syntax is allowed 249 | ; %%: the '%' character 250 | ; %C: %CPU used by the request 251 | ; it can accept the following format: 252 | ; - %{user}C for user CPU only 253 | ; - %{system}C for system CPU only 254 | ; - %{total}C for user + system CPU (default) 255 | ; %d: time taken to serve the request 256 | ; it can accept the following format: 257 | ; - %{seconds}d (default) 258 | ; - %{miliseconds}d 259 | ; - %{mili}d 260 | ; - %{microseconds}d 261 | ; - %{micro}d 262 | ; %e: an environment variable (same as $_ENV or $_SERVER) 263 | ; it must be associated with embraces to specify the name of the env 264 | ; variable. Some exemples: 265 | ; - server specifics like: %{REQUEST_METHOD}e or %{SERVER_PROTOCOL}e 266 | ; - HTTP headers like: %{HTTP_HOST}e or %{HTTP_USER_AGENT}e 267 | ; %f: script filename 268 | ; %l: content-length of the request (for POST request only) 269 | ; %m: request method 270 | ; %M: peak of memory allocated by PHP 271 | ; it can accept the following format: 272 | ; - %{bytes}M (default) 273 | ; - %{kilobytes}M 274 | ; - %{kilo}M 275 | ; - %{megabytes}M 276 | ; - %{mega}M 277 | ; %n: pool name 278 | ; %o: output header 279 | ; it must be associated with embraces to specify the name of the header: 280 | ; - %{Content-Type}o 281 | ; - %{X-Powered-By}o 282 | ; - %{Transfert-Encoding}o 283 | ; - .... 284 | ; %p: PID of the child that serviced the request 285 | ; %P: PID of the parent of the child that serviced the request 286 | ; %q: the query string 287 | ; %Q: the '?' character if query string exists 288 | ; %r: the request URI (without the query string, see %q and %Q) 289 | ; %R: remote IP address 290 | ; %s: status (response code) 291 | ; %t: server time the request was received 292 | ; it can accept a strftime(3) format: 293 | ; %d/%b/%Y:%H:%M:%S %z (default) 294 | ; %T: time the log has been written (the request has finished) 295 | ; it can accept a strftime(3) format: 296 | ; %d/%b/%Y:%H:%M:%S %z (default) 297 | ; %u: remote user 298 | ; 299 | ; Default: "%R - %u %t \"%m %r\" %s" 300 | ;access.format = "%R - %u %t \"%m %r%Q%q\" %s %f %{mili}d %{kilo}M %C%%" 301 | 302 | ; The log file for slow requests 303 | ; Default Value: not set 304 | ; Note: slowlog is mandatory if request_slowlog_timeout is set 305 | ;slowlog = log/$pool.log.slow 306 | 307 | ; The timeout for serving a single request after which a PHP backtrace will be 308 | ; dumped to the 'slowlog' file. A value of '0s' means 'off'. 309 | ; Available units: s(econds)(default), m(inutes), h(ours), or d(ays) 310 | ; Default Value: 0 311 | ;request_slowlog_timeout = 0 312 | 313 | ; The timeout for serving a single request after which the worker process will 314 | ; be killed. This option should be used when the 'max_execution_time' ini option 315 | ; does not stop script execution for some reason. A value of '0' means 'off'. 316 | ; Available units: s(econds)(default), m(inutes), h(ours), or d(ays) 317 | ; Default Value: 0 318 | ;request_terminate_timeout = 0 319 | 320 | ; Set open file descriptor rlimit. 321 | ; Default Value: system defined value 322 | ;rlimit_files = 1024 323 | 324 | ; Set max core size rlimit. 325 | ; Possible Values: 'unlimited' or an integer greater or equal to 0 326 | ; Default Value: system defined value 327 | ;rlimit_core = 0 328 | 329 | ; Chroot to this directory at the start. This value must be defined as an 330 | ; absolute path. When this value is not set, chroot is not used. 331 | ; Note: you can prefix with '$prefix' to chroot to the pool prefix or one 332 | ; of its subdirectories. If the pool prefix is not set, the global prefix 333 | ; will be used instead. 334 | ; Note: chrooting is a great security feature and should be used whenever 335 | ; possible. However, all PHP paths will be relative to the chroot 336 | ; (error_log, sessions.save_path, ...). 337 | ; Default Value: not set 338 | ;chroot = 339 | 340 | ; Chdir to this directory at the start. 341 | ; Note: relative path can be used. 342 | ; Default Value: current directory or / when chroot 343 | chdir = / 344 | 345 | ; Redirect worker stdout and stderr into main error log. If not set, stdout and 346 | ; stderr will be redirected to /dev/null according to FastCGI specs. 347 | ; Note: on highloaded environement, this can cause some delay in the page 348 | ; process time (several ms). 349 | ; Default Value: no 350 | ;catch_workers_output = yes 351 | 352 | ; Clear environment in FPM workers 353 | ; Prevents arbitrary environment variables from reaching FPM worker processes 354 | ; by clearing the environment in workers before env vars specified in this 355 | ; pool configuration are added. 356 | ; Setting to "no" will make all environment variables available to PHP code 357 | ; via getenv(), $_ENV and $_SERVER. 358 | ; Default Value: yes 359 | ;clear_env = no 360 | 361 | ; Limits the extensions of the main script FPM will allow to parse. This can 362 | ; prevent configuration mistakes on the web server side. You should only limit 363 | ; FPM to .php extensions to prevent malicious users to use other extensions to 364 | ; exectute php code. 365 | ; Note: set an empty value to allow all extensions. 366 | ; Default Value: .php 367 | ;security.limit_extensions = .php .php3 .php4 .php5 368 | 369 | ; Pass environment variables like LD_LIBRARY_PATH. All $VARIABLEs are taken from 370 | ; the current environment. 371 | ; Default Value: clean env 372 | ;env[HOSTNAME] = $HOSTNAME 373 | ;env[PATH] = /usr/local/bin:/usr/bin:/bin 374 | ;env[TMP] = /tmp 375 | ;env[TMPDIR] = /tmp 376 | ;env[TEMP] = /tmp 377 | 378 | ; Additional php.ini defines, specific to this pool of workers. These settings 379 | ; overwrite the values previously defined in the php.ini. The directives are the 380 | ; same as the PHP SAPI: 381 | ; php_value/php_flag - you can set classic ini defines which can 382 | ; be overwritten from PHP call 'ini_set'. 383 | ; php_admin_value/php_admin_flag - these directives won't be overwritten by 384 | ; PHP call 'ini_set' 385 | ; For php_*flag, valid values are on, off, 1, 0, true, false, yes or no. 386 | 387 | ; Defining 'extension' will load the corresponding shared extension from 388 | ; extension_dir. Defining 'disable_functions' or 'disable_classes' will not 389 | ; overwrite previously defined php.ini values, but will append the new value 390 | ; instead. 391 | 392 | ; Note: path INI options can be relative and will be expanded with the prefix 393 | ; (pool, global or /usr) 394 | 395 | ; Default Value: nothing is defined by default except the values in php.ini and 396 | ; specified at startup with the -d argument 397 | ;php_admin_value[sendmail_path] = /usr/sbin/sendmail -t -i -f www@my.domain.com 398 | ;php_flag[display_errors] = off 399 | ;php_admin_value[error_log] = /var/log/fpm-php.www.log 400 | ;php_admin_flag[log_errors] = on 401 | ;php_admin_value[memory_limit] = 32M 402 | 403 | -------------------------------------------------------------------------------- /includes/plugins/fastcgi/fastcgi.conf: -------------------------------------------------------------------------------- 1 | [FASTCGI_SERVER] 2 | ServerName php5-fpm 3 | ServerPath /var/run/php5-fpm.sock 4 | MaxConnections 20 5 | 6 | [FASTCGI_LOCATION] 7 | LocationName php5_location 8 | ServerNames php5-fpm 9 | KeepAlive On 10 | Match .*\.php 11 | 12 | -------------------------------------------------------------------------------- /includes/sites/default: -------------------------------------------------------------------------------- 1 | [HOST] 2 | ServerName 127.0.0.1 3 | DocumentRoot /srv/www/default 4 | [LOGGER] 5 | AccessLog /var/log/monkey/access.log 6 | ErrorLog /var/log/monkey/error.log 7 | [ERROR_PAGES] 8 | 404 404.html -------------------------------------------------------------------------------- /includes/supervisor/monkey.conf: -------------------------------------------------------------------------------- 1 | [program:monkey] 2 | command = /usr/local/bin/monkey -D 3 | user = monkey 4 | umask = 002 5 | pidfile = /usr/local/run/monkey/supervisor/monkey.pid 6 | autostart = true 7 | autorestart = true 8 | stdout_logfile = /var/log/supervisor/monkey.log 9 | stderr_logfile = /var/log/supervisor/monkey_err.log 10 | -------------------------------------------------------------------------------- /monkeyServer.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | function clean_system { 3 | echo "Updating system..." 4 | apt-get update -y > /dev/null && apt-get upgrade -y > /dev/null && apt-get dist-upgrade -y > /dev/null && apt-get install -y sysv-rc-conf > /dev/null 5 | 6 | echo "Removing uneeded packages..." 7 | apt-get remove -y apache2 apache2-doc apache2-mpm-prefork apache2-utils apache2.2-bin apache2.2-common bind9 bind9-host bind9utils libbind9-80 rpcbind samba sendmail rmail sendmail-base sendmail-bin sendmail-cf sendmail-doc > /dev/null 8 | 9 | echo "Disabling uneeded services..." 10 | sysv-rc-conf xinetd off 11 | sysv-rc-conf saslauthd off 12 | } 13 | 14 | function install_csf { 15 | echo "Installing Exim4 MTA and re-enabling cron..." 16 | apt-get install -y mailutils cron > /dev/null 17 | 18 | echo "Entering /tmp dir..." 19 | cd /tmp 20 | 21 | echo "Donwloading ConfigServer Firewall..." 22 | wget http://www.configserver.com/free/csf.tgz 23 | 24 | echo "Extractin sources and entering dir..." 25 | tar -xzf csf.tgz 26 | cd csf 27 | 28 | echo "Installing CSF and dependencies..." 29 | apt-get install -y libwww-perl 30 | sh install.sh 31 | 32 | echo "Verifying IPTables modules..." 33 | perl /usr/local/csf/bin/csftest.pl 34 | 35 | # CSF configuration adapted from Centminmod 36 | 37 | echo "Configuring CSF firewall..." 38 | EMAIL="root@localhost" 39 | cp -a /etc/csf/csf.conf /etc/csf/csf.conf-bak 40 | egrep '^UDP_|^TCP_|^DROP_NOLOG' /etc/csf/csf.conf 41 | 42 | cat >>/etc/csf/csf.pignore< /dev/null 92 | 93 | echo "Entering temp. dir..." 94 | cd /tmp/ 95 | 96 | echo "Downloading mbedTLS sources..." 97 | wget https://tls.mbed.org/download/latest-stable 98 | 99 | echo "Extracting mbedTLS sources and entering source dir..." 100 | tar xzf latest-stable 101 | cd mbedtls-1.* 102 | 103 | echo "Configuring build environment..." 104 | cmake -DUSE_SHARED_MBEDTLS_LIBRARY=on . 105 | 106 | echo "Compiling mbedTLS sources..." 107 | make 108 | 109 | echo "Installing mbedTLS libraries..." 110 | make install 111 | 112 | echo "Exiting build directory..." 113 | cd - 114 | 115 | echo "Creating web root directory..." 116 | mkdir -p /srv/www 117 | 118 | echo "Creating default vhost directory..." 119 | mkdir -p /srv/www/default 120 | 121 | echo "Creating web server user and group..." 122 | useradd -s /usr/sbin/nologin -M -d /srv/www monkey 123 | 124 | echo "Downloading monkey web server sources..." 125 | wget http://monkey-project.com/releases/1.5/monkey-1.5.6.tar.gz 126 | 127 | echo "Extracting sources and entering source dir..." 128 | tar zxf monkey-1* 129 | cd monkey-1* 130 | 131 | echo "Configuring build dependencies and flags..." 132 | CFLAGS="-I/usr/local/include/polarssl/" \ 133 | LDFLAGS="-L/usr/local/lib/ -Wl,-rpath=/usr/local/lib/" 134 | 135 | ./configure --prefix=/usr/local \ 136 | --datadir=/srv/www \ 137 | --logdir=/var/log/monkey \ 138 | --sysconfdir=/usr/local/etc/monkey \ 139 | --safe-free \ 140 | --default-user=monkey \ 141 | --default-port=80 \ 142 | --enable-plugins=auth,liana,logger,fastcgi,dirlisting,auth,mbedtls,mandril,cheetah,reverse_proxy 143 | 144 | 145 | echo "Compiling and installing monkey web server..." 146 | make 147 | make install 148 | cd - 149 | 150 | echo "Setting the user monkey as owner of /var/log/monkey and /var/run/monkey..." 151 | mkdir -p /var/log/monkey 152 | chown -R monkey:monkey /var/log/monkey 153 | mkdir -p /usr/local/run/monkey/supervisor 154 | chown -R monkey:monkey /usr/local/run/monkey 155 | 156 | echo "Installing monkey web server init file..." 157 | wget -P /etc/init.d/ https://raw.githubusercontent.com/alexandreteles/monkeyServer/master/includes/init.d/monkey 158 | chmod 755 /etc/init.d/monkey 159 | update-rc.d monkey defaults 160 | update-rc.d monkey enable 161 | 162 | echo "Installing monkey config files..." 163 | mv /usr/local/etc/monkey/monkey.conf monkey.conf.default 164 | wget -P /usr/local/etc/monkey/ https://raw.githubusercontent.com/alexandreteles/monkeyServer/master/includes/conf/monkey.conf 165 | echo " #CUSTOM monkeyServer.sh plugins loading" >> /usr/local/etc/monkey/plugins.load 166 | echo " Load /usr/local/plugins/monkey-dirlisting.so" >> /usr/local/etc/monkey/plugins.load 167 | echo " Load /usr/local/plugins/monkey-logger.so" >> /usr/local/etc/monkey/plugins.load 168 | echo " Load /usr/local/plugins/monkey-liana.so" >> /usr/local/etc/monkey/plugins.load 169 | echo " Load /usr/local/plugins/monkey-logger.so" >> /usr/local/etc/monkey/plugins.load 170 | echo " Load /usr/local/plugins/monkey-auth.so" >> /usr/local/etc/monkey/plugins.load 171 | mv /usr/local/etc/monkey/sites/default /usr/local/etc/monkey/sites/default.default 172 | wget -P /usr/local/etc/monkey/sites/ https://raw.githubusercontent.com/alexandreteles/monkeyServer/master/includes/sites/default 173 | } 174 | 175 | function install_phpfpm { 176 | echo "Configuring dotDeb repositories..." 177 | touch /etc/apt/sources.list.d/dotdeb.list 178 | echo "deb http://packages.dotdeb.org stable all" >> /etc/apt/sources.list.d/dotdeb.list 179 | echo "deb-src http://packages.dotdeb.org stable all" >> /etc/apt/sources.list.d/dotdeb.list 180 | 181 | echo "Installing dotDeb GPG keys..." 182 | wget -q -O - http://www.dotdeb.org/dotdeb.gpg | apt-key add - 183 | 184 | echo "Installing PHP-FPM and basic modules..." 185 | apt-get update -y > /dev/null && apt-get upgrade -y > /dev/null && apt-get dist-upgrade -y > /dev/null && apt-get install -y php5-fpm php5-mcrypt php5-mysqlnd php5-sqlite php-pear php5-gd php-xml-serializer > /dev/null 186 | 187 | echo "Configuring monkey fastcgi plugin and PHP-FPM pool..." 188 | mv /usr/local/etc/monkey/plugins/fastcgi/fastcgi.conf /usr/local/etc/monkey/plugins/fastcgi/fastcgi.conf.default 189 | wget -P /usr/local/etc/monkey/plugins/fastcgi/ https://raw.githubusercontent.com/alexandreteles/monkeyServer/master/includes/plugins/fastcgi/fastcgi.conf 190 | mv /etc/php5/fpm/pool.d/www.conf /etc/php5/fpm/pool.d/www.conf.default 191 | wget -P /etc/php5/fpm/pool.d/ https://raw.githubusercontent.com/alexandreteles/monkeyServer/master/includes/php5/www.conf 192 | echo " Load /usr/local/plugins/monkey-fastcgi.so" >> /usr/local/etc/monkey/plugins.load 193 | 194 | restart_monkey 195 | } 196 | 197 | function restart_monkey { 198 | echo "Restarting IPv4 monkey instance..." 199 | service monkey restart > /dev/null 200 | if [ -f /etc/init.d/monkeyIPv6 ] 201 | then 202 | echo "Restarting IPv6 monkey instance..." 203 | service monkeyIPv6 restart > /dev/null 204 | fi 205 | echo "Done." 206 | clear 207 | } 208 | 209 | function install_mariadb { 210 | echo "Configuring MariaDB repositories..." 211 | apt-get install -y python-software-properties 212 | apt-key adv --recv-keys --keyserver keyserver.ubuntu.com 0xcbcb082a1bb943db 213 | add-apt-repository 'deb http://sfo1.mirrors.digitalocean.com/mariadb/repo/10.0/debian wheezy main' 214 | 215 | echo "Installing MariaDB..." 216 | echo "Please, pay attention at this step as you will be required to insert your MariaDB root password..." 217 | read -p "Press [Enter] key to continue..." keep 218 | apt-get update -y > /dev/null && apt-get install -y mariadb-server > /dev/null 219 | } 220 | 221 | function install_adminer { 222 | echo "Installing SQL Admin..." 223 | echo "-----------------------" 224 | echo "Avaiable vhosts to install: " 225 | find /srv/www/ -type d -exec basename {} \; 226 | echo "-----------------------" 227 | read -p "Install adminer to this vhost: " vHost 228 | mkdir -p /srv/www/${vHost}/sqladmin/ 229 | wget -P /srv/www/${vHost}/sqladmin/ http://downloads.sourceforge.net/adminer/adminer-4.1.0.php 230 | mv /srv/www/${vHost}/sqladmin/adminer-4.1.0.php /srv/www/${vHost}/sqladmin/index.php 231 | wget -P /srv/www/${vHost}/sqladmin/ https://raw.github.com/vrana/adminer/master/designs/pokorny/adminer.css 232 | 233 | 234 | echo "[AUTH]" >> /usr/local/etc/monkey/sites/${vHost} 235 | echo " Location /sqladmin" 236 | echo ' Title "Please, type your credentials to continue."' >> /usr/local/etc/monkey/sites/${vHost} 237 | echo " Users /usr/local/etc/monkey/plugins/auth/vhosts/${vHost}/users.mk" >> /usr/local/etc/monkey/sites/${vHost} 238 | echo "" >> /usr/local/etc/monkey/sites/${vHost} 239 | 240 | read -p "Please, type the username that you will use to access the SQL Admin interface: " admineruser 241 | read -p "Please, type the password that you will use to access the SQL Admin interface: " adminerpass 242 | 243 | echo "Configuring SQL Admin authentication..." 244 | mkdir -p /usr/local/etc/monkey/plugins/auth/vhosts/${vHost}/ 245 | mk_passwd -c /usr/local/etc/monkey/plugins/auth/vhosts/${vHost}/users.mk ${admineruser} ${adminerpass} 246 | } 247 | 248 | function vhost_is_redirect { 249 | read -p "Virtual host hostname: " vhostname 250 | read -p "URL to redirect: " redirecturl 251 | touch /usr/local/etc/monkey/sites/${vhostname} 252 | echo "[HOST]" >> /usr/local/etc/monkey/sites/${vhostname} 253 | echo " ServerName ${vhostname}" >> /usr/local/etc/monkey/sites/${vhostname} 254 | echo " Redirect ${redirecturl}" >> /usr/local/etc/monkey/sites/${vhostname} 255 | echo "[LOGGER]" >> /usr/local/etc/monkey/sites/${vhostname} 256 | echo " AccessLog /var/log/monkey/${1}.access.log" >> /usr/local/etc/monkey/sites/${vhostname} 257 | echo " ErrorLog /var/log/monkey/${1}.error.log" >> /usr/local/etc/monkey/sites/${vhostname} 258 | echo "" >> /usr/local/etc/monkey/sites/${vhostname} 259 | } 260 | 261 | function vhost_is_site { 262 | read -p "Virtual host hostname: " vhostname 263 | mkdir -p /srv/www/${vhostname} 264 | touch /usr/local/etc/monkey/sites/${vhostname} 265 | echo "[HOST]" >> /usr/local/etc/monkey/sites/${vhostname} 266 | echo " ServerName ${vhostname}" >> /usr/local/etc/monkey/sites/${vhostname} 267 | echo " DocumentRoot /srv/www/${vhostname}" >> /usr/local/etc/monkey/sites/${vhostname} 268 | echo "[LOGGER]" >> /usr/local/etc/monkey/sites/${vhostname} 269 | echo " AccessLog /var/log/monkey/${1}.access.log" >> /usr/local/etc/monkey/sites/${vhostname} 270 | echo " ErrorLog /var/log/monkey/${1}.error.log" >> /usr/local/etc/monkey/sites/${vhostname} 271 | echo "[ERROR_PAGES]" >> /usr/local/etc/monkey/sites/${vhostname} 272 | echo " 404 404.html" >> /usr/local/etc/monkey/sites/${vhostname} 273 | echo "" >> /usr/local/etc/monkey/sites/${vhostname} 274 | } 275 | 276 | function create_vhost { 277 | echo "Creating new vhost..." 278 | echo "---------------------" 279 | read -p "Do you want to redirect this vhost to a URL? (yes or no): " isredirect 280 | if [[ "$isredirect" = "yes" ]]; then 281 | vhost_is_redirect 282 | else 283 | vhost_is_site 284 | fi 285 | restart_monkey 286 | } 287 | 288 | function remove_vhost { 289 | echo "Removing a existing vhost..." 290 | echo "-----------------------" 291 | echo "Avaiable vhosts: " 292 | find /usr/local/etc/monkey/sites/ -type f -exec basename {} \; 293 | echo "-----------------------" 294 | read -p "Remove this vhost: " rmvhost 295 | rm -f /usr/local/etc/monkey/sites/${rmvhost} 296 | rm -rf /srv/www/${rmvhost} 297 | restart_monkey 298 | } 299 | 300 | function enable_ipv6 { 301 | echo "Installing IPv6 support..." 302 | wget -P /usr/local/etc/monkey/ https://raw.githubusercontent.com/alexandreteles/monkeyServer/master/includes/conf/monkeyIPv6.conf 303 | echo "Installing monkeyIPv6 web server init file..." 304 | wget -P /etc/init.d/ https://raw.githubusercontent.com/alexandreteles/monkeyServer/master/includes/init.d/monkeyIPv6 305 | chmod 755 /etc/init.d/monkeyIPv6 306 | update-rc.d monkeyIPv6 defaults 307 | update-rc.d monkeyIPv6 enable 308 | } 309 | 310 | function quit { 311 | exit 312 | } 313 | 314 | echo "This script is licensed under the GPLv3 License." 315 | echo -e "Take a look at LICENSE file on our GIT repo to learn more.\n" 316 | echo -e "Written by Alexandre Teles - EJECT-UFBA\n\n" 317 | 318 | while : 319 | do 320 | echo -e "\n\n" 321 | echo "MonkeyServer.sh" 322 | echo "---------------" 323 | echo -e "\n\n" 324 | echo "1. Clean system (run this before installing the web server)" 325 | echo "2. Install Monkey Web Server" 326 | echo "3. Install PHP-FPM support" 327 | echo "4. Install MariaDB DBMS" 328 | echo "5. Install Adminer SQL Admin" 329 | echo "6. Install ConfigServer Firewall" 330 | echo "7. Install Monkey WS IPv6 support" 331 | echo "8. Create a new vhost" 332 | echo "9. Remove a existing vhost" 333 | echo "10. Exit monkeyServer.sh" 334 | echo -e "---------------\n\n" 335 | 336 | read -p "My option is: " option 337 | 338 | case "$option" in 339 | "1") 340 | clean_system 341 | ;; 342 | "2") 343 | install_monkey 344 | ;; 345 | "3") 346 | install_phpfpm 347 | ;; 348 | "4") 349 | install_mariadb 350 | ;; 351 | "5") 352 | install_adminer 353 | ;; 354 | "6") 355 | install_csf 356 | ;; 357 | "7") 358 | enable_ipv6 359 | ;; 360 | "8") 361 | create_vhost 362 | ;; 363 | "9") 364 | remove_vhost 365 | ;; 366 | "10") 367 | quit 368 | ;; 369 | *) 370 | true 371 | ;; 372 | esac 373 | done 374 | 375 | echo "All done. Please restart your machine now or restart monkey web server using: service monkey restart or service monkeyIPv6 restart." 376 | echo "Thank you!" 377 | --------------------------------------------------------------------------------