LAMP pada debian 12

  1. Update system

sudo apt update && sudo apt upgrade -y

2. install aphace2

sudo apt install apache2 -y

3. Install MariaDB

sudo apt install mariadb-server -y

Mengamankan Database

sudo mysql_secure_installation

4. Install PHP

sudo apt install php libapache2-mod-php php-mysql php-xml php-mbstring php-curl php-zip php-gd -y

sudo systemctl restart apache2

Salin folder aplikasi

sudo cp -r folde* /var/www/html/

Atur izin dan kepemilikan direktori aplikasi web:

sudo chown -R www-data:www-data /var/www/html/
sudo chmod -R 755 /var/www/html/

Login ke MySQL/MariaDB untuk membuat database:

sudo mysql -u root -p

Kemudian buat database:

CREATE DATABASE nama_database;
GRANT ALL PRIVILEGES ON nama_database.* TO ‘username’@’localhost’ IDENTIFIED BY ‘password’;
FLUSH PRIVILEGES;
EXIT;

Impor file SQL yang dihasilkan oleh PHPMaker ke dalam database:

mysql -u username -p nama_database < /path/to/output/database.sql

sudo nano /etc/apache2/sites-available/domain.conf

<VirtualHost *:80>
ServerAdmin [email protected]
DocumentRoot /var/www/html/domain
ServerName example.com
ServerAlias www.example.com

<Directory /var/www/html/domain/>
Options FollowSymlinks
AllowOverride All
Require all granted
</Directory>
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined

<Directory /var/www/html/domain/>
RewriteEngine on
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*) index.php [PT,L]
</Directory>
</VirtualHost>

Save the file by pressing Ctrl+O and to exit use- Ctrl+X.

sudo a2dissite 000-default.conf
sudo a2ensite domain.conf

sudo a2enmod headers rewrite env dir mime

sudo systemctl reload apache2

Leave a Reply

Your email address will not be published. Required fields are marked *