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
2) Modify the Default HTTP Server Configuration
Edit the configuration file:
# vim /etc/httpd/conf/httpd.conf
- 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
- 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">
- 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
- Disable truncating long filenames by adding the following configuration:
<IfModule autoindex_module>
IndexOptions NameWidth=*
</IfModule>
Or:
IndexOptions FancyIndexing VersionSort NameWidth*
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
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>
4) Disable or Configure the Firewall
- Disable the Firewall:
Stop the firewall service:
# service iptables stop
Output:
iptables: Clearing firewall rules: [OK]
iptables: Setting chains to policy ACCEPT: filter [OK]
iptables: Unloading modules: [OK]
Check if the firewall is set to start automatically at boot:
# chkconfig --list iptables
Output:
iptables 0:off 1:off 2:on 3:on 4:on 5:on 6:off
Disable firewall from starting automatically at boot:
# chkconfig iptables off
Or:
# chkconfig iptables off --level 2345
After setting, check the firewall status again:
# chkconfig --list iptables
Output:
iptables 0:off 1:off 2:off 3:off 4:off 5:off 6:off
- Configure the Firewall:
Set default rules:
# iptables -A INPUT -j DROP
# iptables -A FORWARD -j ACCEPT
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
Save the firewall settings:
# iptables-save > /etc/sysconfig/iptables
5) Start the httpd
Service and Enable it at Boot
Start the httpd
service:
# service httpd start
Output:
Starting httpd: [OK]
Enable httpd
to start at boot:
# chkconfig httpd on
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.