Got VPS from transip.nl for some time now and had reinstalled couple of times trying to achieve idealistic server.

Used previous version and got stumbled upon many problems, and I was used to Ubuntu out-of-the-box-make-my-life-easy scripts.

This about what I did; a reminder when I have to start over again.

sudo aptitude update && sudo aptitude full-upgrade

Taskel

Use Tasksel to install SSH

tasksel

Passwordless SSH logins

https://www.cs.utah.edu/~bigler/code/sshkeys.html

Fix System Language

# Verify which locales are installed and generated in your system
locale -a

# edit locale
nano /etc/default/locale 

# OR
# set to: en_GB.UTF-8
# LANGUAGE: en:nl:en
dpkg-reconfigure locales

# reboot to take effect
reboot

Enable terminal colors

for root edit: ~/.bashrc

export LS_OPTIONS='--color=auto'
eval "`dircolors`"
alias ls='ls $LS_OPTIONS'

On tab colored list

edit/create: ~/.inputrc
or permanent on: /etc/inputrc

set colored-stats on

Create custom command

cls enhanced ls command with file permissions as numbers

nano /usr/local/bin/cls
chmod +x /usr/local/bin/cls

file: /usr/local/bin/cls

#! /bin/sh
ls --color -l $1 | awk '{k=0;for(i=0;i<=8;i++)k+=((substr($1,i+2,1)~/[rwx]/)*2^(8-i));if(k)printf("%0o ",k);print}'

Install SUDO

Log in with root.

apt-get install sudo
adduser admin sudo
nano /etc/sudoers

file: /etc/sudoers

%sudo  ALL=(ALL:ALL) ALL
admin  ALL=(ALL:ALL) ALL

Look source

Uncomplicated Firewall

apt-get install ufw -y
ufw allow ssh
ufw allow dns
ufw allow http
ufw allow https
ufw allow mail

ufw enable
ufw status verbose

reboot

Install NGINX

apt-get install nginx

Install PHP for Debian 8 (Jessie)

PHP 7.0.0 can be installed using the Dotdeb repository.

Add these two lines to your /etc/apt/sources.list file:

deb http://packages.dotdeb.org jessie all
deb-src http://packages.dotdeb.org jessie all

Add the GPG key:

wget https://www.dotdeb.org/dotdeb.gpg
sudo apt-key add dotdeb.gpg

Install PHP 7:

sudo apt-get update
sudo apt-get install php7.0

Create custom directory structure for nginx configurations and vhosts

cd /var/www
mkdir -p config/nginx/{available,enabled,conf.d,ssl}
echo "include /var/www/config/nginx/enabled/default;" > /var/www/config/nginx/nginx.conf
echo "include /var/www/config/nginx/enabled/*.conf;" >> /var/www/config/nginx/nginx.conf
mkdir -p config/multi-node
mkdir -p vhosts/_default_/httpdocs
mkdir -p vhosts/sylo.space/httpdocs
mkdir -p vhosts/mizu.work/httpdocs
mkdir -p vhosts/mdstn.com/httpdocs

Check out default page and move to proper location

cat /etc/nginx/sites-available/default | grep root

file: /var/www/config/nginx/snippets/php7.0-fpm.conf

location ~ \.php(/|$) {
	try_files      $uri = 404;
	
    fastcgi_pass unix:/var/run/php/php7.0-fpm.sock;
    fastcgi_index  index.php;
    fastcgi_split_path_info ^(.+\.php)(/.*)$;

    include fastcgi_params;

    fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
    fastcgi_param HTTPS off;

    fastcgi_buffers 16 16k;
    fastcgi_buffer_size 32k;
}