Setting up a Test Server – Part 03/??

Alright, since I’m getting nowhere on those errors, even with installing things and updating things, we’re going switch gears a little so I can see progress again and not get too frustrated

Firstly, I’m going to prep my little server to run a couple virtual hosts. One of the things about M&F is that it’s two servers, one for the game, another for the map. Up til now we’ve been running out of /var/www/html, but we’re going to have to move things about because I need a second host.

sudo mv /var/www/html /var/www/maf
sudo mv /var/www/maf /var/www/html/maf
sudo mkdir /var/www/html/qgis

QGIS, of course, being the software for the mapping server.

After that, we’re going to copy the default virtual hosts file a couple times:

sudo cp /etc/apache2/sites-available/000-default.conf /etc/apache2/sites-available/maf.conf

sudo cp /etc/apache2/sites-available/000-default.conf /etc/apache2/sites-available/qgis.conf

cd /etc/apache2/sites-available/

sudo gedit maf.conf

When it’s all said and done, your hosts file should look a bit like this:

<VirtualHost *:80>
ServerName mightandfealty.com
ServerAlias www.mightandfealty.com
ServerAlias web.mightandfealty.com
ServerAlias fiction.mightandfealty.com
ServerAlias office.mightandfealty.com
ServerAlias biz.mightandfealty.com
ServerAlias sfw.mightandfealty.com
ServerAdmin admin@emailhost.something

DocumentRoot /var/www/html/maf/
<Directory />
Options FollowSymLinks
AllowOverride None
</Directory>
<Directory /var/www/html/maf/>
AllowOverride All
Require all granted
Header set Access-Control-Allow-Origin “*”
Header set Access-Control-Allow-Methods “GET,POST”
Header set Access-Control-Allow-Headers “x-prototype-version,x-requested-with”
</Directory>

CustomLog /var/log/apache2/maf.access.log combined
ErrorLog /var/log/apache2/maf.error.log

LogLevel warn

CustomLog /var/log/apache2/access.log combined
ServerSignature On
</VirtualHost>

And the one for the map server would be…

<VirtualHost *:80>
ServerName maps.mightandfealty.com
ServerAlias mapserver.mightandfealty.com
ServerAdmin admin@emailhost.something

DocumentRoot /var/www/html/qgis/
<Directory />
Options FollowSymLinks
AllowOverride None
Require all granted
</Directory>

ScriptAlias /qgis “/var/www/html/qgis/qgis_mapserv.fcgi”
ScriptAlias /tilecache “/usr/lib/cgi-bin/tilecache.fcgi”
<Location /qgis>
Options +ExecCGI
Require all granted
</Location>
<Location /tilecache>
Options +ExecCGI
Require all granted
</Location>

<IfModule mod_expires.c>
ExpiresActive on
ExpiresDefault “access plus 24 hours”
</IfModule>

CustomLog /var/log/apache2/maf.access.log combined
ErrorLog /var/log/apache2/maf.error.log

# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
LogLevel warn

ServerSignature On
</VirtualHost>

My thanks to Tom for providing the the virtual hosts files for the actual game. Should make things much easier.

We’re getting a bit ahead of ourselves though. We’ve not yet installed QGIS or TileCache, both of which this server will require. So let’s get to that then, shall we?

I’ll save you some reading on how to install QGIS and just give you the short version.

sudo gedit /etc/apt/sources.list

In our editor, we’re going to add the following three lines to the very end:

deb     http://qgis.org/ubuntugis xenial main
deb-src http://qgis.org/ubuntugis xenial main
deb     http://ppa.launchpad.net/ubuntugis/ubuntugis-unstable/ubuntu xenial main

It should be noted I’m running Ubuntu 16.04, which is why it says xenial and not trusty (for 14.04). After that, type:

sudo apt-key adv –keyserver keyserver.ubuntu.com –recv-key 073D307A618E5811

sudo apt-get update

sudo apt-get install qgis-server libapache2-mod-fastcgi python-gqis

And yes, I’m including commands as I typed them–while editing things out that I did to figure out what was going on. By this point I already had the fastcgi libraries installed, but best to have them again just in case (maybe it updated in the last week?).

By now, that’s finished installing, so lets restart apache2. With luck, we won’t break everything.