Implement Nginx X-Accel-Redirect #6

Closed
akuznecov opened this Issue Apr 5, 2012 · 7 comments

Comments

Projects
None yet
2 participants

Allows to deliver static file by nginx server and avoids PHP memory consuming(for biiig files) on private\controlled downloads
http://wiki.nginx.org/XSendfile

Requires an additional location in nginx serverconfiguration

I have added a new configuration variable to enable this header.
Also nginx configuration should include

        location ^~ /upload {
                internal;
        }

or

        location ^~ /upload {
                root /path/to/fm/document/root;
                internal;
        }

@Zazza Zazza closed this in 86623cf Apr 5, 2012

Owner

Zazza commented Apr 5, 2012

Right?

server {
listen 80;
server_name domen.com;
if (!-e $request_filename) {
rewrite ^(.+)$ /index.php?main=$1 last;
}
location / {
root /home/www/domen.com/public/;
proxy_pass 127.0.0.1:81;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header Host $host;
}
location ^~ /upload {
internal;
}
}

I haven't enough experience with nginx. I used it only for a proxy of request

For just proxification you should move root directive to server block, or directly to upload location.

See my conf: http://pastebin.com/2GuunCPc

Btw, It requires additional rules for securing application folders, that done with .htaccess files..
or changing structure to front/protected directories

Owner

Zazza commented Apr 5, 2012

ok, thanks! it is possible I will write on a ostora site for an example your nginx conf?

Of course : )

I have added restrictions for system and upload directories, and removed PHP values(it was added for my own configuration, to increase limits, but avoid changing php.ini or FPM configuraion)

New conf here: http://pastebin.com/0DdjBAAt

Owner

Zazza commented Apr 5, 2012

by the evening i will change!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment