ngnix (hosting)

Preparatory step

First, you need to redirect your domain name (e.g., l200.space) to the fixed IP of your new server.

To do this you need to login on your domain name provider's web site and add a Type A DNS entry pointing to the static IP of the router (212.51.155.200). This is how it looks for cyon.ch: [screenshot]

Installing nginx

See also https://etherpad.wikimedia.org/p/server-installation-nginx

commands from here: https://www.linuxbabe.com/ubuntu/install-lemp-stack-ubuntu-20-04-server-desktop

$sudo apt install nginx

$sudo service nginx status

$sudo apt install php

$sudo apt install mariadb-server mariadb-client

$sudo systemctl enable mariadb

$sudo mysql_secure_installation

  • Change the root password? [Y/n] n
  • Remove anonymous users? [Y/n] Y
  • Disallow root login remotely? [Y/n] n
  • Remove test database and access to it? [Y/n] n
  • Reload privilege tables now? [Y/n] Y

WRITE DOWN THE PASSWORDS

checking database SHOW DATABASES;

Creating database and users https://www.linuxbabe.com/ubuntu/install-nextcloud-ubuntu-20-04-nginx-lemp-stack
create database nextcloud;
create user maria@localhost identified by 'your-password';
grant all privileges on nextcloud.* to maria@localhost identified by 'your-password';
flush privileges;

$apt install php7.4 php7.4-fpm php7.4-mysql php-common php7.4-cli php7.4-common php7.4-json php7.4-opcache php7.4-readline php7.4-mbstring php7.4-xml php7.4-gd php7.4-curl

$sudo systemctl start php7.4-fpm

$sudo systemctl enable php7.4-fpm

Important server configuration folders:
/etc/nginx/sites-available (the web sites available on your server)
/etc/nginx/sites-enabled (the web sites actually running on your server)
/var/log/nginx/l200.log & /var/log/nginx/l200_error.log (search here for errors)

Adding a new web site on your web hosting platform

$sudo ln -s /etc/nginx/sites-available/l200.space /etc/nginx/sites-enabled/

sudoers users that can sudo to the machine (become the root user)
user & group: www-data
web admin user -> nethood
$sudo chown www-data:www-data /usr/share/nginx/html -R

web server: nginx (easier for reverse proxy functionality) https://www.howtoforge.com/tutorial/nginx-with-letsencrypt-ciphersuite/