This is an old revision of the document!


Web Server - Debian Buster 11.4 (VPS)

  • I originally switched my VPS from a provider in Thailand to a VPS provided by Server4you 24th September 2021, but they announced to discontinue offering VPS in 2022.
  • I switched 27th July 2022 to Contabo which is a German company running servers in all parts of the world. I chose server location Düsseldorf/Germany and Debian 11.4 as OS.

VPS specification

  • 4 vCPU
  • 8 GB RAM
  • 200 GB SSD
  • 32 TB outgoing traffic / month
  • Debian 11.4
  • SSH and VNC access
  • 3 month is 13.72 Euro
  • My VPS was ready within 5 minutes after order placement

Server Setup

  • Login to the server via SSH as root
  • Install sudo, create the main user, and add him to the sudoers group
    # apt install sudo
    # adduser <user>
    # vi /etc/group (add <user> to line "sudo:x:27:<user>")
  • change the machine name:
    sudo edit /etc/hostname
    sudo edit /etc/hosts
  • enable force_color_prompt=yes in file ~/.bashrc and /root/.bashrc

Security

  • Configure SSH Access
  • Install UFW Firewall
  • Disable root login by changing file /etc/passwd from line 1 to line 2
    root:x:0:0:root:/root:/bin/bash
    root:x:0:0:root:/root:/sbin/nologin

Apache 2.4 & PHP 8.1 with SSL

  • Install Apache
    $ sudo apt update
    $ sudo apt install apache2
  • Install PHP - How To Install PHP (8.1, 7.4 & 5.6) on Debian 11
    $ sudo apt install software-properties-common ca-certificates lsb-release apt-transport-https gnupg
    $ sudo sh -c 'echo "deb https://packages.sury.org/php/ $(lsb_release -sc) main" > /etc/apt/sources.list.d/php.list'
    $ wget -qO - https://packages.sury.org/php/apt.gpg | sudo apt-key add -
    $ sudo apt update
    $ sudo apt install php8.1 php8.1-mysql php8.1-sqlite3
  • Enable required modules
    $ sudo a2enmod rewrite
    $ sudo a2enmod ssl
  • Setup your virtual hosts
  • Create sub folders in /var/log/apache2 if you setup log files for the virtual hosts in sub folders

ProFTP Server

BackupPC

Crontab

  • Root
    $ sudo crontab -e
    35 3 * * 6 certbot renew && /etc/init.d/apache2 restart

Other apps

Install

  • $ sudo apt update
    $ sudo apt install vim
    $ sudo apt install zip
    $ sudo apt install rename
    $ sudo apt install rsync

Config

  • Change visudo editor
    $ sudo update-alternatives --config editor