Question about limit zone

Hi all,

I am total newbie to nginx (just 2 days old).

Before i jump in to the question, i better explain what i have done.

I have nginx + fastcgi (php) running on a server.
This is for a download server.

Every download request is redirected to a php page which checks access
from the db and then X-Accel-Redirect’s to the internal caching

The caching server fetches the file and sends it to the user via nginx.

The configuration is something like this.

http {

limit_zone conn 32k;
root /path/to/php/files;
index index.php;

server {
   location /download {
      rewrite ^/download/(.*)$ /download.php?q=$1 last;

   location ~ \.php {
      # fastcgi setup.

   location /cache/ {
      proxy_pass http://addr.of.cache.server/;
      limit_conn conn 1;
      error_page 503 /error503.php;


I hope that makes sense.

I put the error_page under the internal location
directive as i do not want to limit connections on
other pages.

Now, i would like to know if there is any way to tell
download.php the exact number of sessions active for the
requesting user?

If this can be done, i can know beforehand if the user is already
downloading, and not process his request at all.

Thank you for the help.

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs