Google Drive download page with Nginx and rclone

After writing using rclone to mount services such as Google Drive on Linux, it occurred to me that there are a lot of ways to play around with the ability to mount Google Drive and other netbooks. One of the ways to do this is to combine it with a web server such as Nginx to make a convenient download page.


Download page to implement the main use of Nginx and Nginx provides a number of features .
These include automatic search and authentication.


By default, Nginx indexes directories and returns 403. bash'' autoindex on; The autoindex mode can be successfully started after reloading.

If you are successful, you will need to configure authentication, otherwise you can download files from the netbook as long as you know the address.
Nginx provides us with a very simple way to configure ‘basic auth’:

printf "user:$(openssl passwd -crypt passwd)\n" >> /etc/nginx/conf.d/passwd

where user is your account, passwd is your password, and /etc/nginx/conf.d/passwd is the generated authentication file.
Then add the following to your Nginx configuration file bash'' auth_basic "Authorized"; # Must have a description of the basic validation, otherwise the validation request window will not pop up. auth_basic_user_file /etc/nginx/conf.d/passwd; After reloading the page, open it again and you will see a popup reminding you to verify it.


After the above configuration, it is almost ready, but the default index interface is not very nice.
So I found the Nginx-Fancyindex-Theme beautification template, and configured it to look like this:

It’s a little better looking.


You can get the download link directly on the page, but if you download it directly out of your browser, there will be a validation failure error message, such as: ``bash curl -o

401 Authorization Required

401 Authorization Required

--2018-08-06 21:33:48 -
Resolving (
Connecting to (||:443... Connecting.
HTTP request sent, awaiting response... 401 Unauthorized

Username/Password Authentication Failed.

This time you need to add basic authentication information manually, ``bash’’ curl [email protected]/ -o The following table shows the percentage of the total number of participants in the programme for the biennium 2004-2005. Dload Upload Total Spent Left Speed 100 1682k 100 1682k 0 0 862k 0 0:00:01 0:00:01 —:— 862k

wget --http-user=user --http-password=password
--2018-08-06 21:37:41 -
Resolving (
Connecting to (||:443... Connecting.
HTTP request sent, awaiting response... 401 Unauthorized
Authentication selected: Basic realm="Authorized"
Reusing existing connection to
HTTP request sent, awaiting response... 200 OK Reusing existing connection to
Length: 1722401 (1.6M) [application/zip]
Saving to: '' 100%[=================================>] 1.64M --. -KB/s in 0.02s

2018-08-06 21:37:44 (79.3 MB/s) - '' saved [1722401/1722401]


As rclone mounts on Google Drive, you may notice a significant lead time when downloading larger files, but it’s not a big deal.
In fact, there are many things you can do with rclone, such as write a simple shell script to achieve a weekly/daily/hourly backup of various configurations of Linux and so on.