|
| 1 | +perl-labs |
| 2 | +----------- |
| 3 | + |
| 4 | +**perl-labs** is a set of sample codes whose main purpose is to experiment and test *Perl* and *[Nginx]* |
| 5 | + |
| 6 | +**Nginx** with *Perl* module enabled: |
| 7 | + |
| 8 | + Get [Perlbrew] |
| 9 | +```shell |
| 10 | +export PERLBREW_ROOT=/opt/perl5 |
| 11 | +sudo apt-get install perlbrew build-essential |
| 12 | +# Install |
| 13 | +perlbrew init |
| 14 | +perlbrew mirror |
| 15 | +perlbrew available |
| 16 | +perlbrew install perl-5.20.0 -Dusethreads -Dcccdlflags=-fPIC -Duseshrplib -Duse64bitall -Duselargefiles |
| 17 | +perlbrew install-cpanm or cpan -i App::cpanminus |
| 18 | +perlbrew switch perl-5.20.0 and perlbrew switch-off |
| 19 | +perlbrew use perl-5.20.0 and exit or perlbrew off |
| 20 | +``` |
| 21 | + |
| 22 | + Get [Nginx] |
| 23 | +```shell |
| 24 | +wget http://nginx.org/download/nginx-1.6.0.tar.gz |
| 25 | +tar xfva nginx-1.6.0.tar.gz |
| 26 | +wget https://github.com/yaoweibin/nginx_tcp_proxy_module/archive/v0.4.5.tar.gz -O nginx_tcp_proxy_module-0.4.5.tar.gz |
| 27 | +tar xfva nginx_tcp_proxy_module-0.4.5.tar.gz |
| 28 | +wget https://github.com/openresty/headers-more-nginx-module/archive/v0.25.tar.gz -O headers-more-nginx-module-0.25.tar.gz |
| 29 | +tar xfva headers-more-nginx-module-0.25.tar.gz |
| 30 | +cd nginx-1.6.0 |
| 31 | +wget https://github.com/irr/nginx_tcp_proxy_module/raw/master/tcp-1.6.0.patch |
| 32 | +patch -p1 < tcp-1.6.0.patch |
| 33 | +./configure --with-http_perl_module --with-http_ssl_module --prefix=/opt/perl/nginx --add-module=/opt/perl/nginx_tcp_proxy_module-0.4.5 --add-module=/opt/perl/headers-more-nginx-module-0.25 |
| 34 | +make -j4 |
| 35 | +make install |
| 36 | +sudo ln -s /opt/perl/nginx/sbin/nginx /usr/local/bin/nginx |
| 37 | +or |
| 38 | +sudo make install |
| 39 | +/opt/perl/nginx/sbin/nginx -c /home/irocha/perl/nginx/nginx-perl.conf |
| 40 | +``` |
| 41 | + |
| 42 | +CPAN |
| 43 | +----------- |
| 44 | + |
| 45 | +```shell |
| 46 | +sudo apt-get install libpcre3-dev zlib1g-dev libssl-dev libreadline-dev libsqlite3-dev libpcap-dev libmysqlclient-dev krb5-multidev libkrb5-dev |
| 47 | +``` |
| 48 | + |
| 49 | +```shell |
| 50 | +cpanm -v -n Crypt::CBC |
| 51 | +cpanm -v -n Crypt::Rijndael |
| 52 | +cpanm -v -n DBD::mysql |
| 53 | +cpanm -v -n JSON |
| 54 | +cpanm -v -n JSON::PP |
| 55 | +cpanm -v -n Net::Server::SS::PreFork |
| 56 | +cpanm -v -n PAR::Packer |
| 57 | +cpanm -v -n Redis |
| 58 | +cpanm -v -n Task::Plack |
| 59 | +cpanm -v -n Test::Nginx::Socket |
| 60 | +cpanm -v -n Term::ReadLine::Gnu |
| 61 | +cpanm -v -n Try::Tiny |
| 62 | +cpanm -v -n YAML::Tiny |
| 63 | +cpanm -v -n WWW::Mechanize |
| 64 | +``` |
| 65 | + |
| 66 | +Ubuntu 14.04 LTS (Packages) |
| 67 | +```shell |
| 68 | +sudo apt-get install perl-doc-html libperl-dev libterm-readline-gnu-perl libpar-packer-perl libtry-tiny-perl libjson-perl libredis-perl libcache-memcached-perl libdbd-mysql-perl libplack-perl libauthen-krb5-admin-perl starman libcrypt-cbc-perl libcrypt-rijndael-perl libpod-webserver-perl libpoe-perl libwww-mechanize-perl libnet-pcap-perl libnetpacket-perl libdancer-perl libarchive-any-perl libdatetime-perl libparallel-forkmanager-perl |
| 69 | +``` |
| 70 | +```shell |
| 71 | +http://search.cpan.org/~kazuho/Net-Server-SS-PreFork-0.05/lib/Net/Server/SS/PreFork.pm |
| 72 | + |
| 73 | +[irocha@irrlab perl]$ tar xfva /media/irocha/128G/Sources/Net-Server-SS-PreFork-0.05.tar.gz |
| 74 | +Net-Server-SS-PreFork-0.05/ |
| 75 | +Net-Server-SS-PreFork-0.05/Changes |
| 76 | +Net-Server-SS-PreFork-0.05/inc/ |
| 77 | +Net-Server-SS-PreFork-0.05/lib/ |
| 78 | +Net-Server-SS-PreFork-0.05/Makefile.PL |
| 79 | +Net-Server-SS-PreFork-0.05/MANIFEST |
| 80 | +Net-Server-SS-PreFork-0.05/META.yml |
| 81 | +Net-Server-SS-PreFork-0.05/README |
| 82 | +Net-Server-SS-PreFork-0.05/t/ |
| 83 | +Net-Server-SS-PreFork-0.05/t/00-base.t |
| 84 | +Net-Server-SS-PreFork-0.05/t/01-httpd.pl |
| 85 | +Net-Server-SS-PreFork-0.05/t/01-httpd.t |
| 86 | +Net-Server-SS-PreFork-0.05/t/02-multiport.t |
| 87 | +Net-Server-SS-PreFork-0.05/lib/Net/ |
| 88 | +Net-Server-SS-PreFork-0.05/lib/Net/Server/ |
| 89 | +Net-Server-SS-PreFork-0.05/lib/Net/Server/SS/ |
| 90 | +Net-Server-SS-PreFork-0.05/lib/Net/Server/SS/PreFork.pm |
| 91 | +Net-Server-SS-PreFork-0.05/inc/HTTP/ |
| 92 | +Net-Server-SS-PreFork-0.05/inc/LWP/ |
| 93 | +Net-Server-SS-PreFork-0.05/inc/Module/ |
| 94 | +Net-Server-SS-PreFork-0.05/inc/Test/ |
| 95 | +Net-Server-SS-PreFork-0.05/inc/Test/TCP.pm |
| 96 | +Net-Server-SS-PreFork-0.05/inc/Module/AutoInstall.pm |
| 97 | +Net-Server-SS-PreFork-0.05/inc/Module/Install/ |
| 98 | +Net-Server-SS-PreFork-0.05/inc/Module/Install.pm |
| 99 | +Net-Server-SS-PreFork-0.05/inc/Module/Install/AutoInstall.pm |
| 100 | +Net-Server-SS-PreFork-0.05/inc/Module/Install/Base.pm |
| 101 | +Net-Server-SS-PreFork-0.05/inc/Module/Install/Can.pm |
| 102 | +Net-Server-SS-PreFork-0.05/inc/Module/Install/Fetch.pm |
| 103 | +Net-Server-SS-PreFork-0.05/inc/Module/Install/Include.pm |
| 104 | +Net-Server-SS-PreFork-0.05/inc/Module/Install/Makefile.pm |
| 105 | +Net-Server-SS-PreFork-0.05/inc/Module/Install/Metadata.pm |
| 106 | +Net-Server-SS-PreFork-0.05/inc/Module/Install/Win32.pm |
| 107 | +Net-Server-SS-PreFork-0.05/inc/Module/Install/WriteAll.pm |
| 108 | +Net-Server-SS-PreFork-0.05/inc/LWP/Simple.pm |
| 109 | +Net-Server-SS-PreFork-0.05/inc/HTTP/Server/ |
| 110 | +Net-Server-SS-PreFork-0.05/inc/HTTP/Server/Simple/ |
| 111 | +Net-Server-SS-PreFork-0.05/inc/HTTP/Server/Simple/CGI.pm |
| 112 | +[irocha@irrlab perl]$ cd Net-Server-SS-PreFork-0.05/ |
| 113 | +[irocha@irrlab Net-Server-SS-PreFork-0.05]$ ll |
| 114 | +total 40 |
| 115 | +drwxr-xr-x 5 irocha irocha 4096 Fev 21 2010 ./ |
| 116 | +drwxr-xr-x 4 irocha irocha 4096 Mai 16 17:30 ../ |
| 117 | +-rw-r--r-- 1 irocha irocha 570 Fev 21 2010 Changes |
| 118 | +drwxr-xr-x 6 irocha irocha 4096 Mai 16 17:30 inc/ |
| 119 | +drwxr-xr-x 3 irocha irocha 4096 Mai 16 17:30 lib/ |
| 120 | +-rw-r--r-- 1 irocha irocha 393 Fev 16 2010 Makefile.PL |
| 121 | +-rw-r--r-- 1 irocha irocha 529 Fev 21 2010 MANIFEST |
| 122 | +-rw-r--r-- 1 irocha irocha 608 Fev 21 2010 META.yml |
| 123 | +-rw-r--r-- 1 irocha irocha 33 Fev 16 2010 README |
| 124 | +drwxr-xr-x 2 irocha irocha 4096 Fev 21 2010 t/ |
| 125 | +[irocha@irrlab Net-Server-SS-PreFork-0.05]$ perl Makefile.PL |
| 126 | +*** Module::AutoInstall version 1.03 |
| 127 | +*** Checking for Perl dependencies... |
| 128 | +[Core Features] |
| 129 | +- LWP::Simple ...loaded. (5.827) |
| 130 | +- Test::TCP ...loaded. (0.16 >= 0.06) |
| 131 | +- HTTP::Server::Simple::CGI ...loaded. (0.44) |
| 132 | +- Net::Server ...loaded. (2.007) |
| 133 | +- Server::Starter ...loaded. (0.15 >= 0.02) |
| 134 | +*** Module::AutoInstall configuration finished. |
| 135 | +Checking if your kit is complete... |
| 136 | +Looks good |
| 137 | +Writing Makefile for Net::Server::SS::PreFork |
| 138 | +Writing MYMETA.yml and MYMETA.json |
| 139 | +[irocha@irrlab Net-Server-SS-PreFork-0.05]$ make |
| 140 | +cp lib/Net/Server/SS/PreFork.pm blib/lib/Net/Server/SS/PreFork.pm |
| 141 | +Manifying blib/man3/Net::Server::SS::PreFork.3pm |
| 142 | +[irocha@irrlab Net-Server-SS-PreFork-0.05]$ sudo make install |
| 143 | +Installing /usr/local/share/perl/5.18.2/Net/Server/SS/PreFork.pm |
| 144 | +Installing /usr/local/man/man3/Net::Server::SS::PreFork.3pm |
| 145 | +Appending installation info to /usr/local/lib/perl/5.18.2/perllocal.pod |
| 146 | +``` |
| 147 | +
|
| 148 | +* [nginx_tcp_proxy_module]: add the feature of tcp proxy with nginx, with health check and status monitor |
| 149 | +* [headers-more-nginx-module]: set, add, and clear arbitrary output headers |
| 150 | +
|
| 151 | +Copyright and License |
| 152 | +----------- |
| 153 | +Copyright 2012 Ivan Ribeiro Rocha |
| 154 | +
|
| 155 | +Licensed under the Apache License, Version 2.0 (the "License"); |
| 156 | +you may not use this file except in compliance with the License. |
| 157 | +You may obtain a copy of the License at |
| 158 | +
|
| 159 | + http://www.apache.org/licenses/LICENSE-2.0 |
| 160 | +
|
| 161 | +Unless required by applicable law or agreed to in writing, software |
| 162 | +distributed under the License is distributed on an "AS IS" BASIS, |
| 163 | +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 164 | +See the License for the specific language governing permissions and |
| 165 | +limitations under the License. |
| 166 | +
|
| 167 | +[Nginx]: http://wiki.nginx.org/ |
| 168 | +[Perlbrew]: http://perlbrew.pl/ |
| 169 | +[nginx_tcp_proxy_module]: https://github.com/irr/nginx_tcp_proxy_module |
| 170 | +[headers-more-nginx-module]: https://github.com/agentzh/headers-more-nginx-module |
0 commit comments