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?
Thanks
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!
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.
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,
Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.
Full documentation for every DigitalOcean product.
The Wave has everything you need to know about building a business, from raising funding to marketing your product.
Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.
New accounts only. By submitting your email you agree to our Privacy Policy
Scale up as you grow — whether you're running one virtual machine or ten thousand.
Sign up and get $200 in credit for your first 60 days with DigitalOcean.*
*This promotional offer applies to new accounts only.