# New Ubuntu-Light ppa with the latest nginx code

**URL:** <https://www.ruby-forum.com/t/new-ubuntu-light-ppa-with-the-latest-nginx-code/203166>\
**Category:** NGINX\
**Created:** [February 14, 2011, 6:42pm UTC](https://www.ruby-forum.com/t/new-ubuntu-light-ppa-with-the-latest-nginx-code/203166 "2011-02-14T18:42:03Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![luislavena](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/0ea827/32.png) [@luislavena](https://www.ruby-forum.com/u/luislavena)\
**Post date:** [February 14, 2011, 6:42pm UTC](https://www.ruby-forum.com/t/new-ubuntu-light-ppa-with-the-latest-nginx-code/203166/1 "2011-02-14T18:42:03Z")

</div>

Hello List,

I have just set up an Ubuntu ppa to always keep a tab on the latest  
Nnginx code (currently 0.9.4).

As usual in Ubuntu, you may install it using the following commands:  
sudo add-apt-repository ppa:malan/dev  
sudo apt-get update  
sudo apt-get install nginx

This ppa has been created to let Nginx coexist peacefully with  
php5-fpm and Drupal.

WARNING: this is a ‘LIGHT’ version that has been created to let Nginx  
coexist peacefully with php5-fpm and Drupal (and other cgi dependent  
apps) as such it has 3 main differences from plain Nginx packages:

1. it has been compiled without the following modules: empty\_gif,  
limit\_req, pop3, smtp, imap, split\_clients, uwsgi, scgi, cache;
2. it has been patched to be an ‘anonymized’ web server that only  
reports ‘webserver/0.0.0’ as server name and version;
3. the ivp6 line has been removed from sites-available/default.

Regards,

M.

---

<div class="post-metadata">

**Author:** ![larios](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/bc79bd/32.png) [@larios](https://www.ruby-forum.com/u/larios)\
**Post date:** [February 14, 2011, 10:28pm UTC](https://www.ruby-forum.com/t/new-ubuntu-light-ppa-with-the-latest-nginx-code/203166/2 "2011-02-14T22:28:57Z")

</div>

Hey.

How can i implement mp4; on this

Tried many ways, but urls doesnt work when mp4; is added

It will only be .mp4 files on this script.

_nginx.conf code below:_  
location /d/ {  
perl download::handler;  
}

```
     # usergroup1
     location /download_f/ {
         alias /disk1/site.com/cgi-bin/uploads/;
         internal;
         set $limit_rate $arg_speed;
         limit_conn one 1;
     }

     # usergroup2
     location /download_r/ {
         alias /disk1/site.com/cgi-bin/uploads/;
         internal;
         set $limit_rate $arg_speed;
         limit_conn one 1;
     }

     # usergroup3
     location /download_p/ {
         alias /disk1/site.com/cgi-bin/uploads/;
         internal;
         set $limit_rate $arg_speed;
         limit_conn one 10;
     }

```

_download.pm code below:_  
package download;  
use strict;  
use nginx;  
use Crypt::HCE\_MD5;

my $dl\_key = “somekey”;  
my $upload\_dir="/disk1/site.com/cgi-bin/uploads/";

sub handler {  
my $r = shift;

```
 my $hce = Crypt::HCE_MD5->new($dl_key,"SOMENAME");
 ($_) = $r->filename=~/\/(\w+)\/[^\/]+$/;
 my $l;
 tr|a-z2-7|\0-\37|;
 $_=unpack('B*',$_);
 s/000(.....)/$1/g;
 $l=length;
 $_=substr($_,0,$l & ~7) if $l & 7;
 $_=pack('B*',$_);

 my

```

($srv\_id,$file\_id,$usr\_id,$dx,$id,$dmode,$speed,$i1,$i2,$i3,$i4,$expire)  
= unpack(“SLLSA12ASC4L”, $hce-\>hce\_block\_decrypt($\_) );  
$dx=sprintf("%05d",$dx);  
$speed = $speed.“k” if $speed;

# if($r-\>remote\_addr !~ /^$i1.$i2./)

# {

# $r-\>internal\_redirect("/error\_wrong\_ip.html");

# }

#elsif($expire\<time)  
if($expire\<time)  
{  
$r-\>internal\_redirect("/error\_expired.html");  
}  
elsif(!-f “$upload\_dir/$dx/$id”)  
{  
$r-\>internal\_redirect("/error\_nofile.html");  
}  
else  
{  
$r-\>header\_out(“Content-Disposition”,“attachment”);

$r-\>internal\_redirect("/download\_$dmode/$dx/$id?id=$file\_id&usr=$usr\_id&speed=$speed&".$r-\>args);  
}

```
 return OK;

```

}

1;
