Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement Nginx X-Accel-Redirect #6

Closed
akuznecov opened this issue Apr 5, 2012 · 7 comments · Fixed by #7
Closed

Implement Nginx X-Accel-Redirect #6

akuznecov opened this issue Apr 5, 2012 · 7 comments · Fixed by #7

Comments

@akuznecov
Copy link

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
Copy link
Author

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 as completed in 86623cf Apr 5, 2012
@Zazza
Copy link
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

@akuznecov
Copy link
Author

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

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

@akuznecov
Copy link
Author

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

@Zazza
Copy link
Owner

Zazza commented Apr 5, 2012

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

@akuznecov
Copy link
Author

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
Copy link
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
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants