(20140208 – This post has been amended to provided an updated version of the Apache directive — iceflatline)
Over this past summer I had the pleasure of cobbling together a few spare parts in order to build a Network Attached Storage (“NAS”) box based on FreeNAS. This device has more than fulfilled my initial requirements for reliable file storage and media server in my network. This post will describe how I configured this FreeNAS box to store web files and serve as a document root for the Apache http server implemented in my Ubuntu server. This approach places my local web files on a solid, reliable and centralized RAID 5 disk storage system, and provides good logical and physical separation between file storage and file server functionality.
The versions for the software used in this post were as follows:
All NAS Series Use SSH to log in to the NAS as an administrator. Open the apache-default-modules.conf file: /etc/config/apache/apache.conf Add any additional modules. The Apache HTTP Server is one of the most widely used web server softwares available. A web server is the software that powers a website. It is an open-source software that can be run on a large number of different operating systems, including Windows. This article will teach you how to install the Apache web server on your Windows PC. XigmaNAS is one of the best Linux NAS server solutions for open source enthusiasts. It offers a substantial list of modern-day features that make large-scale data management easier for people with limited or no exposure to NAS. It is based on the FreeNAS open source codebase and features the simplified BSD license. The Apache HTTP Server Project is an effort to develop and maintain an open-source HTTP server for modern operating systems including UNIX and Windows. The goal of this project is to provide a secure, efficient and extensible server that provides HTTP services in sync with the current HTTP standards.
- FreeNAS v0.7.1 Shere (revision 5127)
- Ubuntu Server v10.04 LTS (x64)
- Apache v2.1.14
- nfs-common v1:1.2.0-4ubuntu4
- portmap v6.0.0-1ubuntu2
Configuring the FreeNAS Server
Home Nas Server
I began by creating the directory www on /mnt/files, an existing mount point. This directory would serve as my new Apache document root. Then, I enabled the Network File System (“NFS”) service in FreeNAS so that /mnt/files/www could be accessed from the Ubuntu server. To do this, navigate to Services->NFS->Settings and make sure that the check box for enabling NFS is checked and specify the number of servers that will run (the default value of four should easily handle dozens of users). Now select “Save and Restart.” Next, navigate to Services->NFS->Shares and select the “+” icon, where you are presented with the configuration screen for creating a new NFS share. Enter the path to be shared; the network that is authorized to access this shared path; and, make sure that the “All dirs” checkbox selected. The remaining options can retain their defaults (See Figure 1). Now select “Add” then “Apply changes.”
Configuring the Ubuntu Server
To configure the Ubuntu server I needed to add a couple of packages in order to mount the NFS shared path without error. The nfs-common package is needed when a host acts as an NFS client, and includes a number of processes that ensure a particular NFS connection is allowed and may proceed. Because NFS relies upon remote procedure calls to function, the package portmap is also needed to map RPC requests to the NFS service:
Next, I created a directory so I could mount the NFS shared path. Here you must include the IP address of the FreeNAS server as well as the directory created on it previously:
2 4 6 | #Mount the FreeNAS directory /mnt/file/www for use as an Apache document root 192.168.10.5:/mnt/files/www/media/www nfs defaults00 ###End iceflatline |
I made sure the directory permissions were set correctly, and modified the owner and group associated with /media/www so that the Apache http server could access it:
2 4 6 8 10 | #Alias and directive for FreeNAS directory /mnt/file/www <Directory“/media/www”> AllowOverride None </Directory> ###End iceflatline |
I created an index.html file and moved it to /media/www to test the above configuration, and made sure the file permissions were set correctly:
2 4 6 8 | <html> <h1> </h1> </html> |
Finally, I restarted the Apache http server:
Conclusion
This concludes the post on how to configure a FreeNAS server as an Apache document root, providing a reliable way to store your web files, while at the same time utilizing the Ubuntu and Apache servers for what they do best – serving up those files.
Related Posts
Use the links below to download the Apache HTTP Server from one of ourmirrors. You mustverify the integrity of the downloadedfiles using signatures downloaded from our main distribution directory.The signatures can be verified with ourKEYS file.
Only current recommended releases are available on the main distributionsite and its mirrors. Historical releases, including the 1.3, 2.0 and 2.2families of releases, are available from the archive download site.
Apache httpd for Microsoft Windows is available froma number of third party vendors.
Stable Release - Latest Version:
- 2.4.46 (released 2020-08-07)
If you are downloading the Win32 distribution, please read these importantnotes.
The currently selected mirror ishttps://ftp.halifax.rwth-aachen.de/apache/. If you encounter a problem with this mirror, please selectanother mirror. If all mirrors are failing, there are backup mirrors (atthe end of the mirrors list) that should be available.You may also consult the complete list ofmirrors.
The Apache HTTP Server Project is pleased toannounce therelease of version 2.4.46 of the Apache HTTP Server ('Apache' and 'httpd').This version of Apache is our latest GA release of the new generation 2.4.xbranch of Apache HTTPD and represents fifteen years of innovation by theproject, and is recommended over all previous releases!
Qnap Nas Web Server
For details, see the OfficialAnnouncement andthe CHANGES_2.4 andCHANGES_2.4.46 lists.
Source: httpd-2.4.46.tar.bz2[ PGP ] [SHA256 ]
Source: httpd-2.4.46.tar.gz [PGP ] [SHA256 ]
The Apache Software Foundation and the Apache HTTP Server Project arepleased to announce the release of version 2.3.9 of mod_fcgid, a FastCGIimplementation for Apache HTTP Server versions 2.2 and 2.4. Thisversion of mod_fcgid is a security release.
For information about this module subproject, see the mod_fcgid moduleproject page.
Source as gzip with LF line endings:mod_fcgid-2.3.9.tar.gz[PGP] [MD5] [SHA1]
Source as bz2 with LF line endings:mod_fcgid-2.3.9.tar.bz2[PGP] [MD5] [SHA1]
Win32, Netware or OS/2 Source with CR/LF line endings:mod_fcgid-2.3.9-crlf.zip[PGP] [MD5] [SHA1]
The Apache HTTP Server Project is pleased to announce the release of ApacheFTP module for Apache HTTP Server, version 0.9.6 as beta.
Users are encouraged to test and provide feedback on this beta release. Forinformation about this module subproject, see the mod_ftp module projectpage.
Nas Apache Web Server Login
Source with LF line endings (bzip2 compressed):mod_ftp-0.9.6-beta.tar.bz2[PGP] [SHA1] [MD5]
Source with LF line endings (gzip compressed):mod_ftp-0.9.6-beta.tar.gz[PGP] [SHA1] [MD5]
Win32, Netware or OS/2 Source with CR/LF line endings:mod_ftp-0.9.6-beta-crlf.zip[PGP] [SHA1] [MD5]
It is essential that you verify the integrity of the downloaded files usingthe PGP or SHA signatures. Please read Verifying Apache HTTP ServerReleases for more information on why you shouldverify our releases and how to do it.