Latest interface: 0.3.1
Latest system: 010
This guide assumes:

An overview of steps we are about to take:
  • Install and configure both lighttpd and fastcgi
  • Install and configure PHP5 and php5-sessions extension
  • Install and configure Sudo
  • Download and install the ZFSguru web-interface scripts to the WWW document root
  • Testing access to your website running ZFSguru web-interface
The ZFSguru web-interface scripts are written in PHP and thus require a webserver and PHP to work. First we will start by installing a webserver. The most obvious choice would be Apache, the most used webserver or HTTP(S)-server at the moment. But Apache is rather big and bloated for something simple as we want. Lighttpd combines both Light and HTTPd in one word, which defines itself petty well; a light webserver.


1. Install Lighttpd
As you followed by setup guide, you will have an up-to-date portstree. If you don't, you may wish to update your ports as discussed in the setup guide. Assuming your ports are up to date, go ahead and install Lighttpd:

cd /usr/ports/www/lighttpd
make config
make install clean


After the make config command, you will get an options screen. Use the arrow keys to find the SPAWNCGI option and use space-bar to deselect it; disabling that option. Now use the tab key to get to OK and press enter, continue with the make install clean.


2. Install FastCGI
This is needed to interface PHP with the webserver. Go ahead and install:

cd /usr/ports/www/fcgi
make install clean



3. Configuring Lighttpd
Before we have a look at the lighttpd.conf configuration file, we will do some stuff not done by the installer:

touch /var/log/lighttpd.error.log
chown www:www /var/log/lighttpd.error.log
mkdir /var/run/lighttpd
chown www:www /var/run/lighttpd


NOTE: the above commands have been updated after a typo being discovered; the last two lines incorrectly stated "/var/log" instead of "/var/run".

Now edit the configuration file:

ee /usr/local/etc/lighttpd.conf

First, look for the mod_fastcgi option visible in the first page, remove the # prefix starting that line; this will enable the mod_fastcgi extension.
Now, scroll-down to the FastCGI section and uncomment those lines, and replace php5-cgi-cgi with php5-cgi instead. So you are left with this chunk:

#### fastcgi module
## read fastcgi.txt for more info
## for PHP don't forget to set cgi.fix_pathinfo = 1 in the php.ini
fastcgi.server = ( ".php" =>
( "localhost" =>
(
"socket" => "/var/run/lighttpd/php-fastcgi.so
"bin-path" => "/usr/local/bin/php-cgi"
)
)
)


4. Enabling Lighttpd in /etc/rc.conf
Every startup process or daemon should have a setting in the /etc/rc.conf file that enables them, and is required in order to start the daemon. Go ahead and edit the /etc/rc.conf file:

ee /etc/rc.conf

Now add the following to this file on a new line, location is not important but you should keep similar items together for your own understanding:

lighttpd_enable="YES"   # This enables the Lighttpd webserver
5. Now we will install PHP:

cd /usr/ports/lang/php5
make config
make install clean


When presented with the configuration screen, select the CGI option and disable the Apache module if you're not using Apache. Enabling the CLI is recommended as well, this would allow running PHP scripts on the command line, and may be used in the future to facilitate features such as scheduled scrubs or mails.

After installation of PHP, install the php5-session extension, as well:

cd /usr/ports/www/php5-session
make install clean



6. Configuring PHP
Now we are going to create a php.ini file. Normally PHP runs without one when freshly installed and uses all default values. Two example configuration files recommended either for development or production are provided. I recommend using the development PHP.ini, that uses strict error checking to notify of any problems that may occur.

cp /usr/local/etc/php.ini-development /usr/local/etc/php.ini
Sudo is a program that allows normal users to execute commands at root privileges. This obviously can be a security risk to your system. The scripts currently rely on sudo root access without password prompt to the www user. If your system is accessible publicly via the internet, you may want to consider additional security precautions, such as a FreeBSD 'jail'. This is not covered in this installation guide.

7. Install Sudo
This one is simple, just accept the default options:

cd /usr/ports/security/sudo
make install clean



8. Configuring Sudo
Now we will configure sudo. Assuming you run a BASH-shell, you can run this command:

export EDITOR=ee
visudo


Now you edit sudo configuration file; be careful making changes here. Add the following to the end of the file:

# Grant www user root access without password prompt
%www ALL=(ALL) NOPASSWD: ALL


And use escape-enter-enter to exit the file and save changes.
The Document Root is where the files are stored on the webserver which are visible to the 'outside' of the world; your local LAN in this case. This is where the ZFSguru web-interface scripts will go.


9. Installing the ZFSguru web-interface scripts
Go ahead and create your Document Root at the default location:

mkdir /usr/local/www/data
cd /usr/local/www/data


Now we will download the ZFSguru web-interface scripts and extract it in the /usr/local/www/data folder:

fetch http://zfsguru.com/files/ZFSguru-0.1.6-script.tgz
tar xvfz ZFSguru-0.1.6-script.tgz
10. Starting the Lighttpd webserver
Use this command to start the Lighttpd webserver:

/usr/local/etc/rc.d/lighttpd start

It should say it's started; if not check the logs for errors:

tail /var/log/messages
cat /var/log/lighttpd.error.log


If you can detect no errors, you can go ahead and see if you can access the webserver now.

Open up Firefox or another browser, and enter http://10.0.0.20 in the address field, replacing 10.0.0.20 with the IP-address if your FreeBSD server. If you're unsure, type 'ifconfig' on the shell and look for "inet x.x.x.x" as your IP-address. This is different than your external IP-address from your internet provider. It will either begin with 10 or with 192.168. Those are local IP-ranges for internal networks.

You should be able to access the ZFSguru web-interface by now. Congrats!

Valid XHTML 1.1