Build a directory list program - H5ai

Keywords: Web Development Linux

        H5ai is a modern file indexer for HTTP Web servers, focusing on your files. Catalogs are displayed in an attractive way, and browsing them can be enhanced by different views, breadcrumbs, and tree overviews. Originally h5ai was an acronym for HTML5 Apache index, but now it also supports other Web servers.
        h5ai is not only beautiful in appearance, but also very practical. It can be used to share files, play videos online and view pictures. More importantly, it is a lightweight directory listing program. You can install one on your vps or experience it on your virtual machine. As a small file sharing server, it is absolutely enough. As a directory indexing program, It can only be downloaded and viewed, not uploaded.
Here is an example picture of h5ai


System: centos7
Environment: apache   php7.0+
Software: h5ai software download address:(

**1. Install apache**

#yum install httpd


**2. Install php**
-Because there is no php7.0 version in the software warehouse of CentOS7, we need to install a third-party source

#yum install epel-release -y
#rpm -Uvh rpm -Uvh

  • Make sure there are no older versions of php to prevent conflicts
#yum remove -y php*

  • Install php72 version
#yum install -y php72w php72w-cli php72w-fpm php72w-common php72w-devel php72w-gd

  • -View php version
#php -v


**3. Download h5ai's compressed package**

  • Use the wget command to download the specific version. There is a h5ai download link at the top of the article. You can go to the link to view the latest version, or upload the zip package to the system through other methods.
  • Go to the root directory of the website / var/www/html /, and use the wget command to download
#cd /var/www/html
#wget --no-check-certificate

  • Unzip the zip file and move the compressed package to another directory (in case of h5ai configuration problems, you can unzip it and replace it)
#mv /home

  • Configure _h5ai

         1. Set the private and public directory permissions in _h5ai to 777

#chmod 777 private public

  • Set the cache directory in the private and public directories to 777 permissions
#chmod 777 /var/www/html/_h5ai/private/cache /var/www/html/_h5ai/public/cache


**4. Configure the httpd.conf file**

#vim /etc/httpd/conf/httpd.conf
  • Add the following in < ifmodele dir_module > of httpd.conf:
index.php /_h5ai/public/index.php

  • If you are using nginx or lighttpd instead of httpd, you can view the method (h) on the official website ttps:// ), I copied it below.

Apache httpd 2.2/2.4: in httpd.conf or in the root directory's .htaccess file set for example:

DirectoryIndex  index.html  index.php  /_h5ai/public/index.php

lighttpd 1.4: in lighttpd.conf set for example:

index-file.names += ("index.html", "index.php", "/_h5ai/public/index.php")

nginx 1.2: in nginx.conf set for example:

index  index.html  index.php  /_h5ai/public/index.php;

Cherokee 1.2: in cherokee.conf set for example:

vserver!1!directory_index = index.html,index.php,/_h5ai/public/index.php

**5. Start PHP FPM and httpd services, and set startup and self startup**

#systemctl start php-fpm httpd
#systemctl enable php-fpm httpd

**6. Entry http://IP/_h5ai/public/index.php View h5ai current operation information**

  • According to the self-test results of the current operating environment and functional modules, * * the password is empty * *. If the web page cannot be accessed, you can see paragraph 8 at the end of the article

  • You will see two no, one is the plug-in for preview video and the other is the plug-in for pdf viewing

         1. Install FFmpeg rpm software package and add a third-party source first

#rpm --import
#rpm -Uvh
#yum install ffmpeg ffmpeg-devel -y
  • After the installation is successful, execute the ffmpeg command to check whether there are all commands, and then refresh the web page to check whether it becomes YES

  • Install the PDF thumbs function. This time, use the ImageMagick function to view PDF. Refresh the web page after installation
#yum install -y ImageMagick


**7. Use the directory listing program**

  • We enter http://IP Or http: / / domain name, check it out

  • Let's create some directories in the root directory of the website and check the directory relationship on the website
#mkdir -p /var/www/html / Web programming / html

  • Now we should be familiar with the directory relationship of the website. h5ai we can identify and display the files in the root directory, or create some directories and files
Site root
 ├─ _h5ai
 ├─ your files
 └─ and folders
  • Upload pictures and videos and view them on h5ai website

  • What else can h5ai be set?
1. Batch download
2. header footer 
3. Index function
4. QR code download
5. Other personalization
 I won't set it one by one here. The specific method can be Baidu search**h5ai Configuration and beautification**It has been shared by bloggers.

**8. Pay special attention. If your web page can't get in, it may be that selinux and firewall are turned on**

  • Close the firewall and selinux, configure to permanently close selinux and add firewall ports and rules below Baidu. I won't write too many such tutorials. It's too troublesome.
#Setenforce0 (temporarily closed)
#Systemctl stop firewalld
  • -After closing, refresh the web page to see if it works normally

Posted by llama on Mon, 04 Oct 2021 15:11:50 -0700