Install LEMP Stack (Nginx, MariaDB, PHP) on Debian 12
Loncat ke navigasi
Loncat ke pencarian
Tahap 1 : Lakukan update dan upgrade reposetory
sudo apt update && sudo apt upgrade
Tahap 2 : Install Nginx Web Server on Debian 12
sudo apt install nginx
Test Konfigurasi Nginx :
sudo nginx -t
Tahap 3 : Install MariaDB Server on Debian 12
sudo apt install mariadb-server
Tahap 4 : Securing MariaDB Server
sudo mysql_secure_installation
Testing MariaDB Installation
sudo mysql
Tahap 5: Install PHP on Debian 12
sudo apt install php-fpm php-mysql php-gd php-cli php-curl php-mbstring php-zip php-opcache php-xml
Configure Nginx to Execute PHP Files
Menentukan lokasi penyimpanan.
location / { # First attempt to serve request as file, then# as directory, then fall back to displaying a 404. try_files $uri $uri/ =404;}
Menjadi :
location / { try_files $uri $uri/ /index.php?$args;}
Menjadi :
location ~ \.php$ { include snippets/fastcgi-php.conf; fastcgi_pass unix:/var/run/php/php-fpm.sock;}
Terakhir restart Nginx.
sudo systemctl restart nginx
Test Your Debian 12 LEMP Installation
Buat file index.html
isi sebagai berikut :
echo "<?php phpinfo(); ?>" | sudo tee /var/www/html/test.php