I have configure Nginx with the upload_module.

I can upload & resume files but anybody can post to the /upload location.

is there a way of making the location /upload internal and use X-Accel-Redirect so that only authenticated users could post files?

Or any idea of how to secure the server so that only certain users could post files, having the authentication logic on the application side?.

  • Does nginx knows when a user is authenticated? How do you auth users?
    – adrian7
    Commented Aug 13, 2015 at 7:37

2 Answers 2


You could use nginx's auth_basic, auth_request, or any other authentication method to wrap the /upload location.


You need to use ngx_http_auth_basic_module that allows limiting access to resources by validating the user name and password using "HTTP Basic Authentication" protocol.

server {
    # auth
    auth_basic "Restricted site";
    auth_basic_user_file /opt/nginx/.htpasswd;

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .