AjaXplorer on FreeNAS 8.3

In which I set-up a nice web GUI for my home server...

So I recently invested in a HP ProLiant MicroServer N54L to backup my PC to. Also it should be quite useful as a media server etc. I've installed FreeNAS as my OS but wanted to have a easy-to-use Web interface for accessing my files over my Network. I followed the guide here: http://forums.freenas.org/threads/howto-ajaxplorer-with-nginx-in-plugin-jail-mysql-optional-webdav.10297/ but a few things need changing as always.

 

 

Jails

There is a guide on setting up a jail on your FreeNAS system here: http://www.freenas.org/images/resources/freenas8.3.1/freenas8.3.1_guide.html# __RefHeading__33325_859822269

Installing Nginx + PHP

Make sure to extract portsnap:

portsnap extract

Then fetch updates:

portsnap fetch update

Replace  the outdated version of pkg-config:

pkg_delete --force pkg-config-0.25_1cd /usr/ports/devel/pkgconf && make install clean

Install Nginx:

cd /usr/ports/www/nginx && make install clean

Making sure to add the following options in config with spacebar: HTTP_DAV, HTTP_FLV, HTTP_GZIP_STATIC, HTTP_PERL, HTTP_SSL, HTTP_DAV_EXT. During this section you may find the fetch for libgcrypt fails. Go to http://www.freshports.org to check for an alternate download location. Then extract it to /usr/ports/security/libgcrypt:

cd /usr/ports/security tar xvjf libgcrypt-1.5.2.tar.bz2 mv libgcrypt-1.5.2 libgcrypt cd libgcrypt
./configure make install

Then PHP 5:

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

With the option: FPM Accept all configs after this with no changes

cd /usr/ports/lang/php5-extensions && make install

With these options: CURL, GD, MBSTRING, MCRYPT, MySQL, MySQLi, OPENSSL, PDO_MySQL, ZIP, ZLIB Accept all configs after this with no changes

Insert this into /etc/rc.conf:

nginx_enable="YES" php_fpm_enable="YES"

Then copy the php init script:

cp /usr/local/etc/php.ini-production /usr/local/etc/php.ini

Set up SSL

cd /usr/local/etc/nginx
openssl genrsa -des3 -out server.key 1024
openssl req -new -key server.key -out server.csr
openssl x509 -req -days 3650 -in server.csr -signkey server.key -out server.crt 
cp server.key server.key.orig
openssl rsa -in server.key.orig -out server.key

Installing AjaXplorer 5

Grab the latest version:

fetch http://sourceforge.net/projects/ajaxplorer/files/ajaxplorer/stable-channel/5.0.1/ajaxplorer-core-5.0.1.tar.gz/download

Change to the target directory and un-tar:

mkdir /usr/local/www/ajaxplorer cd /usr/local/www/ajaxplorer tar -xvzpf ajaxplorer.tar.gz

Configure Nginx

Edit the following files† -  /usr/local/etc/nginx/php-fpm.conf, /usr/local/etc/nginx/nginx.conf, /usr/local/etc/nginx/fastcgi_params according to this link: http://forums.freenas.org/threads/howto-ajaxplorer-with-nginx-in-plugin-jail-mysql-optional-webdav.10297/

Then run:

cp /usr/local/etc/nginx/php-fpm.conf /usr/local/etc/php-fpm.conf
/usr/local/etc/rc.d/php-fpm restart
/usr/local/etc/rc.d/nginx restart

†The built in editor command on FreeBSD is ee

Configure AjaXplorer

If you go to https://<jail ip>/ajaxplorer you should see the config screen:

To sort the specific errors I had:

Security Breach: This can appear even if your ajaxplorer/data directory is protected. When I check all my data directories returned a 403 forbidden message which is ok.

PHP Session: Set a session.save_path in php.ini. /tmp works.

PHP Output Buffer: Set output_buffering to "Off" in php.ini and restart the service.

Server charset encoding: Set the locale in conf/bootstrap_conf.php as suggested:

define("AJXP_LOCALE", "en_GB.UTF-8");

Then you should see the ready screen:

Follow the Wizard and hit "Install Ajaxplorer Now!" when you're done. After that follow the AjaXplorer documentation!

Tom Out!