Tag Archives: server

Redirect sites to the rootfolder without using a new vhost on Nginx.

Map. It’s a construction that maps the the value to a variable.
map $http_host $name {

*.bob.com bob;
default bob2;

So if your hostname ($http_host) would be anything from *.bob.com than your variable $name will have it’s value set to bob. Otherwise it’s set to bob2.
The “hostnames”, following the nginx man – indicates that source values can be hostnames with a prefix or suffix mask.

RL Example:

You can map the matching domain name to the rootfolder name.

map $http_host $root {

.funnycats.com funny_cats;
.funnydogs.com funny_dogs;

default funny_animals;


in the “server” section you can use:

root /var/www/$rootpath/;

Than reload nginx and you can check if it’s working with curl:

curl -H “Host: bork.funnycats.com


Mad load caused by acpi_pad

If your machine hits crazy load and your processor is: Intel(R) Xeon(R) CPU E5-2630 v4 @ 2.20GHz
Check with top what’s wrong. In my case I had load 44 without any special reason (non production server). The problem was: acpi_pad.
Kernel: ~3.10 but google say it’s also on higher Linux Kernels (4.x)

Dirty and nasty – “rmmod acpi_pad” and blacklisting the module with ” echo “blacklist acpi_pad” >> /etc/modprobe.d/blacklist-acpi_pad.conf ”

A nicer and suggested solution that I have to check: updating the bios of the server machine.

Oh, the issue is not brand-related. Some people have it on Supermicro boards, Dell boards. I’ve had it on a Lenovo server.

SunwellCore Server

SunwellCore is an early fork of Trinity Core, a World of Warcraft emulator for one of the expansions – Wrath of the Lich King. It’s mainly known by beeing used on a international server – Sunwell, which was closed somwhere at the end of 2015 (or maybe early 2016, can’t remember). But enough of the whining about the server, let’s do the business.

For this server you’ll need (the same as for TrinityCore):
– the code (I just git cloned https://github.com/Kittnz/Sunwell.git)

– a database – Sunwell Core Crew have done it on MySQL, I’m doing it on MariaDB;

– a machine that will handle everything;

– A will to make it work.

  1. Meet the requirements for TrinityCore
  2. Get the code
    git clone https://github.com/Kittnz/Sunwell.git 
  3. For SunwellCore you should also get libACE, libtool, autoconf and those packages which are in the “dep” folder in my case I had to
    apt install libace-dev autoconf libtool libemalloc-dev libgsoap-dev libutfcpp-dev libg3d-dev
  4. To compile the source with map tools you need to get libmpq. It’s provided in Sunwell/dep/libmpq  I didin’t get this part working. I have compiled my version without map tools.
    You need to run:

    sh ./autoconf.sh
    make -j $(nproc)
    and as root, to install for the whole system: make install
  5. In the cloned repo create a build folder and change dir into it:
     mkdir build && cd build 
  6. After that we have to prepare our files for make and make install. To do that I’ve used:
    cmake ../ -DCMAKE_INSTALL_PREFIX=/home/<username>/sunwell_server -DCONF_DIR=/home/<username>sunwell <del>-DTOOLS=1</del>
  7. I’ve had some problems with the cmake so I made a small change in the file:

    I’ve edited the line

     return uint32(mktime(&lt) + _timezone);


    return uint32(mktime(&lt)); 
  8.  If we’ve done everything correctly we should be able to compile and install our files. If you have a multicore machine you can use
    make -j $(nproc) 

    to use all the cores. Otherwise you can use


    or if you don’t want all the cores to be involved, you can use

     make -j <numberofcores> 

    and set the desired number of cores. Of course the same thing works for

     make install 


     make -j $(nproc) 
  9. If you have problems with swap and RAM during compilation – keep on reading. Otherwise continue to the next step. During the install of my machine, I have set my swap partition too small. Apparently it was causing problems during the compilation (all ram and swap was full) so I’ve created a swapfile.

All these commands are supposed to be done as root or sudo

9.1 Create a file. I’ve created a 1 gigabyte file:

 dd if=/dev/zero of=/tmp/swap bs=1M count=1000



9.2 Format the swap file:

 mkswap /tmp/swap 

9.3  Change the chmod to 0600

 chmod 0600 /tmp/swap 

9.4 Add the file to /etc/fstab

/tmp/swap swap swap defaults 0 0 

9.5 Run

 swapon -a 

to activate the swap


9.6 Redo the compilation & installation process.

10. Database

The fabulous creators of Sunwell Core have actually provided us with the database. It’s full of their fixes (or hacks and temp solutions, as the creators of creators of TC like to call it on their IRC channel).

First of all you need to create a user and some databases, I’ve changed a bit the script provided by the TC crew:



CREATE DATABASE `sc_characters` DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci;


GRANT ALL PRIVILEGES ON `sc_world` . * TO 'sunwell'@'localhost' WITH GRANT OPTION;

GRANT ALL PRIVILEGES ON `sc_characters` . * TO 'sunwell'@'localhost' WITH GRANT OPTION;

GRANT ALL PRIVILEGES ON `sc_auth` . * TO 'sunwell'@'localhost' WITH GRANT OPTION;

after that you need to “fill” the database with data. The Sunwell crew provided all changes and all you need to do is:

 mysql -usunwell -p databasename < file_to_import.sql 

or if you have more files you cant also use:

 cat *.sql | mysql -usunwell -p databasename 

As you can guess you need to import the files to the right database. They mostly go to the *world database.

11. Maps

Because I wasn’t able to compile the core with tools, I had to use the provided maps. All you need to do is to unpack them to the right folder (pointed in the worldserver.conf). Here are the files: DbcMapsMMapsVMaps

12. Config

Once again, the Sunwell Crew thought about us and prepared a config. They’re located in the extras folder in the cloned git repo. After compilation copy them into the /etc folder. You need to edit the part about connecting to the database (in both, worldserver and authserver), RealmName (in worldserver), DataDir (well, you can leave it, but I create a seperate one) and your LogsDir (also in worldserver). For example, check the Trinity Core Documentation

13. Hey ho, let’s go!

1. Get screen
2. go to your compiled folder
3. start on seperate screen sessions:




If you have don everything right, you should start your own server. If you want to set it public / lan than follow Realmlist Table paragraph

This little tutorial is not perfect. It might contain mistakes. But I hope it helped you.

If you have any questions or suggestions post them in the comment section. I’m not a developer. I’m not an expert. But I’m someone who spent some time on this server and I am very grateful to Xinef, Pussywizard, Jajcer and rest of the crew for allowing me to meet all the awesome people and spend great nights and evenings. I hope you guys are doing well.