[VPS] Nginx Fancy Index + PHP Uploader

Hi there, I want to share an easy way to set up a web server and use it as a public download server, in case you may need to share files. Nowadays, at some point, we are in the need to share files, backups, images, text and more as quickly as possible. Some of us share content through: Google Drive, OneDrive from Microsoft, DropBox or similar services but if you have a VPS without use and don’t know what to do with it, this post will show you how to use it as a your own sharing web server, it will work on KVM or OVZ virtualization and it won’t require high resources, it will perfectly work with low-end instances.

For this post I’ll be using an OVZ7 NAT instance thanks to Web Horizon, this instance is located at Poland and have 1 CPU core, 256MB RAM, 4GB Disk and 500GB monthly bandwidth. These NAT instance have 1 shared IPv4 with 21 usable ports. I’ve installed Debian 10 (Buster) and establish a SSH session, I’m all set to begin with this. Before any steps, update the OS by execute:

apt update -y && apt upgrade -y && apt dist-upgrade -y && apt autoremove -y

Once that’s completed, reboot the VM instance.

Step #1: Installing Nginx and PHP

Install all the required packages by executing:

apt install nginx-extras php-fpm nano curl wget sudo -y

Step #2: Configuring the Domain Name

Web Horizon allow to manage all your OVZ instances through Virtualizor, go there and login, the login information should be on the “Service Activated” email. Go to the “Domain Forwarding” option and add your domain name to work with port 80 (http) or 443 (https). For this post I’ll use Cloudflare as DNS manager and poland.alexgoldcheidt.com as the domain name to work with port 80 (http) it won’t be necessary to work with 443 port (https) since Cloudflare will be doing that on its end. If you point your web browser to your mapped domain name, (poland.alexgoldcheidt.com at my end), you should see the “Welcome to nginx!” website.

Step #3: Configuring Nginx

Go back to the terminal and modify the nginx vhost file by executing:

nano /etc/nginx/sites-ava*/default

First add: index.php in the index section and then add the following lines inside the “location /” section:

fancyindex on;
fancyindex_localtime on;
fancyindex_exact_size off;
fancyindex_header "/Nginx-Fancyindex-Theme-light/header.html";
fancyindex_footer "/Nginx-Fancyindex-Theme-light/footer.html";
fancyindex_ignore "Nginx-Fancyindex-Theme-light";
fancyindex_ignore "upx";
fancyindex_name_length 255;

Now uncomment the following lines at the “pass PHP scripts to FastCGI server” section:

location ~ \.php$ {
include snippets/fastcgi-php.conf;
fastcgi_pass unix:/run/php/php7.3-fpm.sock;

Save the changes and restart Nginx service by executing:

systemctl daemon-reload; systemctl restart nginx

Step #4: Downloading Nginx fancyindex Theme

Go to /var/www/html and execute:

cd /var/www/html; rm -rf *; wget https://github.com/Naereen/Nginx-Fancyindex-Theme/archive/refs/heads/master.zip; unzip *.zip; rm -f *.zip; mv Nginx*/* .

If you point your web browser to your mapped domain name, (poland.alexgoldcheidt.com at my end), you should see the “Nginx-Fancyindex-Theme” website.

Now rename the “README.md” to “README.backup”, this because that file add content about the usage of the theme. If you find that useful, you can leave it there.

mv README.md README.backup

You can modify header and footer information by executing:

nano Nginx*-light/header*
nano Nginx*-light/footer*

Additionally, with custom code you can even add a basic server’s stats like: https://emily.alexgoldcheidt.com/

From this point, you are now able to download files through wget or curl and share them via the fancy index website powered by Nginx. I can download a “Raspberry Pi Education Manual” and share it publicly. To do that, I’ve executed:

wget https://downloads.raspberrypi.org/Raspberry_Pi_Education_Manual.pdf

Step #4: Installing ShareX-Custom-Upload

Until now, there is a big limitation with our web server, we can add files only via terminal (through wget or curl) or by an FTP client in case we need to share files from our local workstation. That’s why I’ve included this useful tool to upload files from and to the web server via PHP. It is also compatible with usernames/logins (without a database) and have a private back-end, that means, that only specific IP Addresses can access to it and be able to upload files.

Download, install and configure ShareX-Custom-Upload by executing:

wget https://github.com/JoeGandy/ShareX-Custom-Upload/releases/download/2.1.1/ShareX-Custom-Upload-2.1.1.zip; unzip *.zip; rm -f ShareX*.zip; mv release upx; rm -rf upx/u; ln -s /var/www/html upx/u; cp upx/config.default.php upx/config.php; chmod 777 upx/u

Check a couple of settings in the ShareX-Custom-Upload configuration file by executing:

nano upx/config.php

Modify the “base URL” and add your IP address in order to access to the ShareX-Custom-Upload back-end, save changes and now point your web browser to your mapped domain name, (poland.alexgoldcheidt.com/upx/ at my end), you should see the “My File Uploader” website. From this point, you can now upload, rename and delete files, including copy/past text, right into the web server via PHP and all uploaded files will also be available on your fancy index website.


Hint: to increase/decrease the upload size limit, check values of “post_max_size” and “upload_max_filesize” in the file:

nano /etc/php/7.3/fpm/php.ini

Save changes and restart php-fpm service by executing:

systemctl restart php7.3-fpm.service

Also, the directory “upx” (it can be any word you want) isn’t visible in the fancy index website because the idea of this post in to maintain the upload back-end private but if you want to reverse that, go to: nano /etc/nginx/sites-ava*/default and comment the line: fancyindex_ignore "upx"; save the changes and restart Nginx service by executing: systemctl daemon-reload; systemctl restart nginx


This is just an easy/fun way to share files publicly or privately through a nice fancy index powered by Nginx + an uploader back-end via PHP.

Have a question? Leave a comment.

 101 total views,  3 views today

This is a honest review, as you can see there's no ads, affiliate links nor warez content on my blog. All reviews of servers, apps, devices and tools are original content generated by myself. There's not any commercial influence on my blog content from any company nor project developers. Support my website to ensure it stays that way

[VPS] Nginx Fancy Index + PHP Uploader
0 0 votes
Article Rating
Notify of
Inline Feedbacks
View all comments
Scroll to top