1.First of all, install apache2
$ sudo apt-get install apache
2.Secondly, edit the configuration files
Here, i choose /home/www as my file listing site root directory.
$ cd /etc/apache2/sites-available
$ sudo cp 000-default.conf 001-filehost.conf
Edit 001-filehost.conf and add the following lines
DocumentRoot /home/www
Options +Indexes
IndexOptions FancyIndexing FoldersFirst NameWidth=* DescriptionWidth=*
At the apache2 global setting file, add the root directory /home/www setting entry,
otherwise you will get an error of 403 (access permission deny).
<Directory /home/www/>
Options Indexes FollowSymLinks
AllowOverride None
Require all granted
</Directory>
3.Enable 001-filelist.conf site
$ sudo a2ensite 001-*
$ sudo a2dissite 000-*
Then copy all the files and directories you want to list to /home/www, when you open http://$youripaddress
with browser, it will show the file listing table.