DEV Community

Cong Li
Cong Li

Posted on

Introduction to Configuring HTTP File Server for GBase 8a MPP Cluster Data Load

In the previous article, we introduced how to configure an FTP server. Today, let's walk through the configuration of an HTTP file server.

Reference to the previous article: https://dev.to/congcong/gbase-8a-mpp-cluster-ftp-file-server-configuration-guide-ddi

HTTP Server Configuration

Using Apache to Set Up an HTTP File Server

1) Install apr and httpd

# rpm -ivh apr-1.3.9-3.el6_1.2.x86_64.rpm apr-util-1.3.9-3.el6_0.1.x86_64.rpm apr-util-ldap-1.3.9-3.el6_0.1.x86_64.rpm
# rpm -ivh httpd-2.2.15-15.el6.x86_64.rpm httpd-manual-2.2.15-15.el6.noarch.rpm httpd-tools-2.2.15-15.el6.x86_64.rpm
Enter fullscreen mode Exit fullscreen mode

2) Modify the Default HTTP Server Configuration

Edit the configuration file:

# vim /etc/httpd/conf/httpd.conf
Enter fullscreen mode Exit fullscreen mode
  • Change the server name:
# If your host doesn't have a registered DNS name, enter its IP address here.
# You will have to access it by its address anyway, and this will make 
# redirections work in a sensible way.
#ServerName www.example.com:80
ServerName 192.168.10.114:80
Enter fullscreen mode Exit fullscreen mode
  • Change the file storage location from /var/www/html to /var/www/files, or keep /var/www/html as the default if you prefer to skip this step:
# DocumentRoot: The directory out of which you will serve your
# documents. By default, all requests are taken from this directory, but
# symbolic links and aliases may be used to point to other locations.
#
#DocumentRoot "/var/www/html" 
DocumentRoot "/var/www/files"
#
# This should be changed to whatever you set DocumentRoot to.
#
#<Directory "/var/www/html">
<Directory "/var/www/files">
Enter fullscreen mode Exit fullscreen mode
  • Adjust other parameters:
# Enable or disable memory-mapping (on by default), set to off for NFS-mounted systems
# EnableMMAP off
# Enable or disable the use of the sendfile system call (on by default), set to off for NFS-mounted systems
# EnableSendfile off
# Connection timeout, default is 60 seconds
# Timeout 60
Enter fullscreen mode Exit fullscreen mode
  • Disable truncating long filenames by adding the following configuration:
<IfModule autoindex_module>
 IndexOptions NameWidth=*
</IfModule>
Enter fullscreen mode Exit fullscreen mode

Or:

IndexOptions FancyIndexing VersionSort NameWidth*
Enter fullscreen mode Exit fullscreen mode

Note: If you do not disable filename truncation, Apache may return incomplete filenames when loading HTTP files using wildcards, which can cause errors.

3) Edit the Default Welcome Page Configuration

Edit the welcome configuration file:

# vim /etc/httpd/conf.d/welcome.conf
Enter fullscreen mode Exit fullscreen mode

Comment out the following lines (to avoid the default 403 error page when there is no default page under the HTML directory):

#<LocationMatch "^/+$">
# Options -Indexes
# ErrorDocument 403 /error/noindex.html
#</LocationMatch>
Enter fullscreen mode Exit fullscreen mode

4) Disable or Configure the Firewall

  • Disable the Firewall:

Stop the firewall service:

  # service iptables stop
Enter fullscreen mode Exit fullscreen mode

Output:

  iptables: Clearing firewall rules:                                 [OK]
  iptables: Setting chains to policy ACCEPT: filter                  [OK]
  iptables: Unloading modules:                                       [OK]
Enter fullscreen mode Exit fullscreen mode

Check if the firewall is set to start automatically at boot:

  # chkconfig --list iptables
Enter fullscreen mode Exit fullscreen mode

Output:

  iptables    0:off  1:off  2:on   3:on   4:on   5:on   6:off
Enter fullscreen mode Exit fullscreen mode

Disable firewall from starting automatically at boot:

  # chkconfig iptables off
Enter fullscreen mode Exit fullscreen mode

Or:

  # chkconfig iptables off --level 2345
Enter fullscreen mode Exit fullscreen mode

After setting, check the firewall status again:

  # chkconfig --list iptables
Enter fullscreen mode Exit fullscreen mode

Output:

  iptables    0:off  1:off  2:off  3:off  4:off  5:off  6:off
Enter fullscreen mode Exit fullscreen mode
  • Configure the Firewall:

Set default rules:

  # iptables -A INPUT -j DROP
  # iptables -A FORWARD -j ACCEPT
Enter fullscreen mode Exit fullscreen mode

Open the HTTP port:

  # iptables -I INPUT -p tcp -m tcp --dport 80 -j ACCEPT 
  # iptables -I OUTPUT -p tcp -m tcp --sport 80 -j ACCEPT
Enter fullscreen mode Exit fullscreen mode

Save the firewall settings:

  # iptables-save > /etc/sysconfig/iptables
Enter fullscreen mode Exit fullscreen mode

5) Start the httpd Service and Enable it at Boot

Start the httpd service:

# service httpd start
Enter fullscreen mode Exit fullscreen mode

Output:

Starting httpd:                                           [OK]
Enter fullscreen mode Exit fullscreen mode

Enable httpd to start at boot:

# chkconfig httpd on
Enter fullscreen mode Exit fullscreen mode

6) Copy Data Files to /var/www/files (or /var/www/html)

7) Access the File List via Browser

You can now access the file list by visiting http://192.168.10.114 (as configured in ServerName 192.168.10.114:80).


This guide provides a step-by-step process for setting up an HTTP file server using Apache to load data into the GBase 8a MPP Cluster.

Top comments (0)