wget not working on django droplet

I have a backups directory, and I want to pull files from there using wget. But every time I try, I get 404.

When I try using wget, there is no new entry in the nginx error or access logs.

In the /etc/nginx/sites-enabled/default file, I turned on auto index (I added “autoindex on;”):


location /backups {
    alias /home/django/django_project/django_project/backups;
    autoindex on;

After doing that, I got a directory listing in my browser, and I could download the file by saving from there.

I do not want the directory to have a publicly accessible listing – I only want to download the files via wget.

How do I enable wget downloads?


Submit an answer

This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Want to learn more? Join the DigitalOcean Community!

Join our DigitalOcean community of over a million developers for free! Get help and share knowledge in Q&A, subscribe to topics of interest, and get courses and tools that will help you grow as a developer and scale your project or business.

I changed locations, and now, in the new location, wget is not working.

To recap, I want to wget files from a backups directory on the server to my local machine. In August, it was working. But I have since changed locations. Now, from my local machine in the new location, wget is not working, I get 404 Not Found. If I turn autoindex on, I can display the directory using a browser on my local machine, but only if I use the IP address, not the URL site name. I did this to troubleshoot, as I do not normally want the directory to display, I only want to download files using wget. So autoindex is now off.

I would appreciate some assistance to get wget working, thanks,

Hi @netvigator,

Wait, first, let me know please from where you are running your Wget command to where?

Additionally, do disable directory listing in Nginx, you need to add the following :

autoindex off;

Inside your location blocks. Basically, like that:

server {
        listen 80 default_server;
        listen [::]:80 default_server;
        root /var/www/html;
        index index.html index.htm index.nginx-debian.html;
        server_name _;
        location / {
autoindex off;
                try_files $uri $uri/ =404;

That should do it.

Waiting for a bit more clarification on the other part of the question.