Install LEMP Stack (Nginx, MariaDB, PHP) on Debian 12: Perbedaan antara revisi
Loncat ke navigasi
Loncat ke pencarian
(12 revisi perantara oleh pengguna yang sama tidak ditampilkan) | |||
Baris 1: | Baris 1: | ||
= Tahap 1 : Lakukan update dan upgrade reposetory = | |||
sudo apt update && sudo apt upgrade | sudo apt update && sudo apt upgrade | ||
= Tahap 2 : Install Nginx Web Server on Debian 12 = | |||
sudo apt install nginx | |||
Test Konfigurasi 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 === | === Configure Nginx to Execute PHP Files === | ||
Menentukan lokasi penyimpanan. | 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;}<br /> | |||
Menjadi : | |||
location / { | |||
try_files $uri $uri/ /index.php?$args;} | |||
Menjadi : | Menjadi : | ||
location ~ \.php$ { | |||
include snippets/fastcgi-php.conf; | |||
fastcgi_pass unix:/var/run/php/php-fpm.sock;} | |||
Terakhir restart Nginx. | Terakhir restart Nginx. | ||
sudo systemctl restart nginx | |||
=== Test Your Debian 12 LEMP Installation === | === Test Your Debian 12 LEMP Installation === | ||
Buat file index.html | Buat file index.html | ||
isi sebagai berikut : | isi sebagai berikut : | ||
echo "<?php phpinfo(); ?>" | sudo tee /var/www/html/test.php |
Revisi terkini sejak 14 Mei 2024 16.23
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