Install LEMP Stack (Nginx, MariaDB, PHP) on Debian 12: Perbedaan antara revisi

Dari Catatan Pak Samsul
Loncat ke navigasi Loncat ke pencarian
 
(4 revisi perantara oleh pengguna yang sama tidak ditampilkan)
Baris 1: Baris 1:
=== Tahap 1 : Lakukan update dan upgrade reposetory ===
= 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 ===
= Tahap 2 : Install Nginx Web Server on Debian 12 =
  sudo apt install nginx
  sudo apt install nginx
Test Konfigurasi Nginx :  
Test Konfigurasi Nginx :  
  sudo nginx -t
  sudo nginx -t


=== Tahap 3 : Install MariaDB Server on Debian 12 ===
= Tahap 3 : Install MariaDB Server on Debian 12 =
  sudo apt install mariadb-server
  sudo apt install mariadb-server


=== 4. Securing MariaDB Server ===
= Tahap 4 : Securing MariaDB Server =
  sudo mysql_secure_installation
  sudo mysql_secure_installation


=== Testing MariaDB Installation ===
==== Testing MariaDB Installation ====
  sudo mysql
  sudo mysql


=== Tahap 5: Install PHP on Debian 12 ===
= 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
  sudo apt install php-fpm php-mysql php-gd php-cli php-curl php-mbstring php-zip php-opcache php-xml


Baris 22: Baris 22:
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;}
  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$ {
location / {    try_files $uri $uri/ /index.php?$args;}
  include snippets/fastcgi-php.conf;
 
  fastcgi_pass unix:/var/run/php/php-fpm.sock;}
Menjadi :
 
  location ~ \.php$ {include snippets/fastcgi-php.conf;
  fastcgi_pass unix:/var/run/php/php-fpm.sock;}


Terakhir restart Nginx.
Terakhir restart Nginx.
Baris 40: Baris 39:
=== 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
  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