wget not working on django droplet

Posted August 29, 2021 217 views
NginxUbuntu 20.04

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;”):

# customization
location /backups {
alias /home/django/djangoproject/djangoproject/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?


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.

Submit an Answer
1 answer

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.