Results 1 to 8 of 8
  1. #1
    Join Date
    Aug 2004

    Question Lighttpd/Nginx x-senfile/X-Accel-Redirect, possible action after download?

    If you know how x-sendfile (lighttpd) and X-Accel-Redirect(Nginx) headers working you know that in php script I can use this headers when I want to download some files direct with lighttpd/nginx and not with php, that is great, but I need to know is possible to set some header in lighttpd/nginx to execute some php script/code after download finished (to back to php)????

    Now I searching for solution but look like don`t exist and that is bad...


  2. #2
    Join Date
    Jun 2003
    World Wide Web
    You can instruct the http server (apache for example) how to handle a file using the AddHandler directive. Also you can instruct the browser , how to handle this file using the AddType directive.

    You cam use of these in .htaccess file or the web server conf file. - the name says it all!
    Managed Cloud Servers
    Server Management and Monitoring
    24x7 outsourced customer support

  3. #3
    Join Date
    Aug 2004
    No no no...I don`t need that!
    Somebody who know how x-sendfile (lighttpd) and X-Accel-Redirect(Nginx) working will know what I need from my question...

    User visit my site, click to download some file, on my server I have setup that file download working with php (to check users, some limits etc.), if all OK php will send header x-sendfile (lighttpd) or X-Accel-Redirect (nginx) and file download will start with lighttp/nginx like static file and lighttpd/nginx stop php process...that is great for server resources but I need option to execute some simple php script when download finished and I need to know is that possible...

    I hope that somebody can understan my bad english....


  4. #4
    It is not easy, you need to hack into the code to get it working.

  5. #5
    Join Date
    Aug 2004
    Do you do that on your install?

  6. #6


    hi gurika

    did you found a solution to your problem?

    I found that the module you want in nginx is called post_action.

    However I am still looking for solution with Lighttpd.

    I know C/C++ and I can hack the code, but I have no time to research where the change must be done.


  7. #7
    Join Date
    Dec 2004
    Might be easier to simply monitor the access log file than hack the Lighttpd source.


    tail -f -n 0 /var/log/lighttpd/access.log | php your-log-entry-parse-script-that-reads-from-stdin.php

  8. #8
    This may do the trick, but is difficult and slow.
    The way I decided to go is with nginx and post_action.
    It also support X-SendFile functionality as well, but is called "X-Acel",
    another nice trick is that nginx support shaper via "X-Acel" header too.
    Already tested it, all works.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts