Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Implement Nginx X-Accel-Redirect #6

Closed
akuznecov opened this Issue · 7 comments

2 participants

@akuznecov

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

@akuznecov

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 issue from a commit
Alexander Kuznecov X-Accel-Redirect implementation;
Fixes #6;
86623cf
@Zazza Zazza closed this in 86623cf
@Zazza
Owner

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

@akuznecov

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

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

@akuznecov

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

@Zazza
Owner

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

@akuznecov

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

@Zazza
Owner

by the evening i will change!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.