nginx rewriting sub domain into a directory internally

To make a long story short, the most efficient way of doing this is simply to change the document root according to the sub domain

So within your server stanza, you can simply do the following

server_name ~^(?.+)\.tech-g\.com$;
    root /var/www_nginx/$sub;

This way, when you add a directory such as myothersite.com inside your nginx web directory, visitors comming to myothersite.com.tech-g.com will end up being served content from the directory /var/www_nginx/myothersite.com

No rewriting URLs needed, and no evil if statements either

MySQL would not install on debian

Had problems with

apt-get install mysql-server
dbconfig-common: writing config to /etc/dbconfig-common/phpmyadmin.conf
Setting up mysql-server-5.5 (5.5.37-0ubuntu0.14.04.1) ...
/var/lib/dpkg/info/mysql-server-5.5.postinst: line 146: logger: command not found
ATTENTION: An error has occured. More info is in the syslog!
/var/lib/dpkg/info/mysql-server-5.5.postinst: line 236: logger: command not found
dpkg: error processing package mysql-server-5.5 (--configure):
subprocess installed post-installation script returned error exit status 127
dpkg: dependency problems prevent configuration of mysql-server:
mysql-server depends on mysql-server-5.5; however:
Package mysql-server-5.5 is not configured yet.

So the sollution was to remove mysql completely,

sudo apt-get purge mysql*
sudo apt-get autoremove
sudo apt-get autoclean

then run

apt-get dist-upgrade

then installing mysql-server again

apt-get install mysql-server

Datacenters

Here is a list of services i use, this list is for my reference, but i might as well share it with you guys.

1- Hetzner- general purpose
2- online.net personal range, 6 Euro via nano dedicated servers with 500GB drives
3- oneprovider.com Something about getting your servers anywhere in the world, good for local services, like getting a server next to it’s customers for low latency
4- Softlayer (God knows why i pay this much, still not sure why I’m using them)
5-Database mart – I have 1 Windows VPS from them (4GB ram for $18 along with windows server 2012), running ok up to now (Invoices out on the first, due by the 15th).