Ubuntu Server – Apache2: Could not reliably determine the server’s fully qualified domain name, using for ServerName


Restarting the Apache Web Server on Ubuntu Server (12.04 at the time of writing) gives me the following error:

apache2: Could not reliably determine the server's fully qualified domain name, using for ServerName

To fix this error add ServerName localhost to /etc/apache2/httpd.conf, as follows:

echo 'ServerName localhost' | sudo tee -a /etc/apache2/httpd.conf

Restart Apache to make sure that the issue is resolved:

sudo /etc/init.d/apache2 restart

Ubuntu – How to Create and Host favicon.ico Files on Apache

I recently installed an web-based feed aggregator called Gregarius on Apache and found that there was no favicon displayed next to the URL or in the browser tab.

So I took this as an opportunity to learn two things – first how to create a favicon.ico file on Ubuntu and second how to configure Apache to display favicon files.

A favicon is typically 16×16 pixles. You can create an image yourself (as a.png file for now) or use your favorite search engine to find some free ones.

I found some great, hand drawn icon sets and decided to use one of the 16×16 .png files from them:

Click the above images to download the icon sets.

I extracted the downloaded icon sets and copied the icon of my choice (rss_16x16) to my home directory.

Now we just have to convert the .png icon file to an .ico file. To do this we will install a command line utility called icoutils.

Click Applications, Accessories and then Terminal and enter the following command:

sudo apt-get install icoutils

Convert the .png icon to an .ico file as follows:

icotool -o favicon.ico -c rss_16x16.png

Obviously you will need to change the filename of the .png file to the name of your chosen icon.

The final step is a little configuration on your Apache web-server. The following line of code is a basic template that we will adjust according to our environment. Typically this line of code just needs to be inserted into the site header between the <head> and </head> tags.

<link rel="shortcut icon" href="htttp://domain.com/favicon.ico" />

For my environment I had to adjust the href destination to the ip-address of my web-server followed by the path to my favicon.ico:

<link rel="shortcut icon" href=""

Gregarius is written in PHP and so I had to add the above line to /var/www/rss/themes/defaut/web/header.php. This location will vary depending on your application / environmrnent.

Then I restarted Apache:

sudo /etc/init.d/apache2 restart

All that was left to do was to refresh my Gregarius web-page and my favicon was there in all its glory!



Many thanks to my brother for helping me figure out where the shortcut icon code belonged in my Gregarius installation.

Ubuntu Server – Installing Gregarius, a Web-based RSS Aggregator

Gregarius is a Web-based RSS, RDF, and ATOM news aggregator that will allow you to access your news feeds from anywhere (if you so desire).

I installed Gregarius in an Ubuntu Server minimal virtual machine on VMware ESXi. During the installation I elected to install the LAMP webserver and SSH roles.

To install Gregarius download it from here and then copy it to the home directory on your server.

Install unzip and extract the Gregarius download:

sudo apt-get update
sudo apt-get install unzip
unzip gregarius-*.zip

You will now see a folder called gregarius in your home directory. I chose to rename the folder to rss:

mv gregarius rss

Copy the rss folder to your Apache web directory:

sudo cp -R rss /var/www/rss

At this point I needed to edit php.conf so that I could open .php files in a browser and create a virtual host. I have previously covered editing php.conf here and how to install Webmin here.

With Webmin installed creating a virtual host is a simple process.

In Webmin click Servers and Apache Webserver in the left hand menu – then click the Create virtual host tab.

Click the file browser button for the Document Root field and then navigate to /var/www/rss and then click OK. Click the Create Now button.

Open a browser and begin installation of Gregarius: http://<server-ip>/rss.

Gregarius will notify you of any un-met requirements, but I did not experience any issues here:

The next step is to enter settings for the Gregarius database. For database UserName and Password enter a username and password of your choice. For the Database Table Prefix I entered rss.

To allow Gregarius to create a database for you enter root as the Admin UserName and your MySQL password as the Admin Password.

Note: The MySQL password was defined during the installation of the LAMP role earlier.

Scroll to the bottom of the page and click the Download dbinit.php file button. Save the file and upload dbinit.php to the home directory on your server and then copy it to /var/www/rss/:

sudo cp dbinit.php /var/www/rss

As dbinit.php contains your MySQL password you should delete the file from your home directory:

rm dbinit.php

Now open a browser and browse to: http://<server-ip>/rss/index.php.

Click on the Admin button and define a username and password.

Log in and click the Feeds button.

Note: You should be able to access Gregarius using the following URL from now on: http://<server-ip>/rss

To add this site as a feed, for example, just copy and paste the feed URL https://pricklytech.wordpress.com/feed/ into the Add a feed field and then click the Add button:

Click the Home button and you will be able to see your feeds:

The only issue that I have experienced is that Gregarius takes some time respond every time I click the Admin button. After that the application seems to respond quite well though. My workaround was to bookmark the Feeds page, which allowed me to add feeds much more quickly that clicking Admin followed by Feeds.

I am quite looking forward to accessing my feeds without having a local client installed on any of my machines …

Update: Since adding more feeds I encountered an issue and could not browse my feeds, even though they were listed. The quick fix was to edit the rss.output.usemodrewrite setting and set its value to false. This setting can be found here: http://<server-ip>/rss/admin/index.php?view=config. See here for more details.

Ubuntu Server – Installing Webmin

Webmin is a web-based interface for system administration. Webmin has a vast range of functionality, my interest at this point is to create virtual hosts for Apache.

First we need to download Webmin from here – at the time of writing the current version is 1.540.

Copy the webmin*.deb file to your server and then make sure that the dependencies are installed:

sudo apt-get install perl libnet-ssleay-perl openssl
libauthen-pam-perl libpam-runtime libio-pty-perl

Install Webmin as follows:

sudo dpkg --install webmin_1.540_all.deb

We can now log in to Webmin: https://<server-ip&gt;:10000/

Log in with the account that you set up when you installed Ubuntu Server.

Links to the Webmin Wiki and documentation for individual modules can be found here.

Ubuntu Server – Apache: PHP Files Are Downloaded Instead of Opening in Browser

After installing a basic LAMP (Linux, Apache, MySQL & PHP) stack in Ubuntu you will find that Apache will prompt you to download .php files (rather than opening them in your browser).

The solution is to edit the /etc/apache2/mods-available/php5.conf file:

sudo nano /etc/apache2/mods-available/php5.conf

The lower half of php5.conf reads as follows:

# To re-enable php in user directories comment the following lines
# (from <IfModule ...> to </IfModule>.) Do NOT set it to On as it
# prevents .htaccess files from disabling it.
<IfModule mod_userdir.c>
<Directory /home/*/public_html>
php_admin_value engine Off

Simply comment out the lines from <IfModule …> to </IfModule> as directed:

# To re-enable php in user directories comment the following lines
# (from <IfModule ...> to </IfModule>.) Do NOT set it to On as it
# prevents .htaccess files from disabling it.
#    <IfModule mod_userdir.c>
#        <Directory /home/*/public_html>
#            php_admin_value engine Off
#        </Directory>
#    </IfModule>

Save php5.conf as then restart Apache:

sudo /etc/init.d/apache2 restart

You will now be able to open .php files in your browser.