بسم الله

Bismillah

Command terminal for setup debian server

Login with root user

Here example command, you can change username or your server ip addres and port open to ssh remote

Change locale

locale-gen en_US.UTF-8 | sudo locale-gen id_ID.UTF-8

Install the command application that we will need soon

apt install sudo
apt install curl
apt install mtr
apt install htop

Activate sudo for regular linux users

visudo

Find this line and then add it below

# User privilege specification
root    ALL=(ALL:ALL) ALL
debian  ALL=(ALL:ALL) ALL

Install MariaDB with Repository

sudo apt-get install software-properties-common dirmngr apt-transport-https
sudo apt-key adv --fetch-keys 'https://mariadb.org/mariadb_release_signing_key.asc'
sudo add-apt-repository "deb [arch=amd64,arm64,ppc64el] http://mirror.biznetgio.com/mariadb/repo/10.6/debian $(lsb_release -cs) main"
sudo apt update && sudo apt upgrade -y
sudo apt install mariadb

Install Nginx latest version with repository

sudo apt install gnupg gnupg1 gnupg2 -y
sudo wget https://nginx.org/keys/nginx_signing.key
sudo apt-key add nginx_signing.key

Add Nginx in source.list.d directory

sudo nano /etc/apt/sources.list.d/nginx.list

Copy and paste this script, dont forget to change codename Debian Linux Code Name (ex: Bookworm or Bulleyes etc)

deb https://nginx.org/packages/mainline/debian/ bookworm nginx
deb-src https://nginx.org/packages/mainline/debian/ bookworm nginx

Save and exit nano editor

sudo apt update && sudo apt upgrade -y
sudo apt install nginx

Configure server block

cd /etc/nginx/
sudo mkdir sites-available sites-enabled
sudo systemctl enable nginx
sudo nano nginx.conf

Add below line script after conf.d/*.conf

include /etc/nginx/conf.d/*.conf;
include /etc/nginx/sites-enabled/*.conf;

Save and exit editor

sudo systemctl restart nginx

Test wheter Nginx runs succesfully

curl localhost

You can edit the default index page

sudo nano /usr/share/nginx/html/index.html

Here the script for reverse proxy

server {
    listen 80;
    listen [::]:80;

    server_name suaraquran.com;

    location / {
        proxy_set_header Host $host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_pass http://172.16.0.123;
    }

    real_ip_header proxy_protocol;
    set_real_ip_from 127.0.0.1;
}

You can change proxy_pass line command to IP Address you want to reverse

الحمد لله

Linked Refrences:

Google.Com Nginx.Org