ngnix (hosting)

Preparatory step

First, you need to redirect your domain name (e.g., 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 ( This is how it looks for [screenshot]

Installing nginx

See also

commands from here:

$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


checking database SHOW DATABASES;

Creating database and users
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/ /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)