Tutorial

Memulai Web Server di Raspberry

cuma catatan pribadi aja yang dishare di blog pribadi

Install LAMP (Linux, Apache, MySQL, PHP) di Raspberry

Biasa, namanya abis install di update dulu

sudo apt-get update -y
sudo apt-get upgrade -y

Install dah LAMPnya

sudo apt-get install apache2 mariadb-server php php-mysql php-mbstring -y

dah semua, sekarang config 1-1 dari Apache2.

Bikin folder log Apache2 di /var/log/apache2 dan ubah user foldernya jadi pi:pi

sudo mkdir /var/log/apache2
sudo chown -R pi:pi /var/log/apache2

Setting config Apache2 di Raspberry Pi ada di /etc/apache2 setting apache2.conf jadi gini :

DefaultRuntimeDir ${APACHE_RUN_DIR}
PidFile ${APACHE_PID_FILE}
Timeout 300
KeepAlive On
MaxKeepAliveRequests 100
KeepAliveTimeout 5

# These need to be set in /etc/apache2/envvars
User ${APACHE_RUN_USER}
Group ${APACHE_RUN_GROUP}

HostnameLookups Off

ErrorLog ${APACHE_LOG_DIR}/error.log

LogLevel warn

# Include module configuration:
IncludeOptional mods-enabled/*.load
IncludeOptional mods-enabled/*.conf

# Include list of ports to listen on
Include ports.conf

# Sets the default security model of the Apache2 HTTPD server.

<Directory />
Options FollowSymLinks
AllowOverride None
Require all denied
</Directory>

<Directory /usr/share>
AllowOverride None
Require all granted
</Directory>

<Directory /var/www/>
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
</Directory>

AccessFileName .htaccess

<FilesMatch "^\.ht">
Require all denied
</FilesMatch>

LogFormat "%v:%p %h %l %u %t \"%r\" %>s %O \"%{Referer}i\" \"%{User-Agent}i\"" vhost_combined
LogFormat "%h %l %u %t \"%r\" %>s %O \"%{Referer}i\" \"%{User-Agent}i\"" combined
LogFormat "%h %l %u %t \"%r\" %>s %O" common
LogFormat "%{Referer}i -> %U" referer
LogFormat "%{User-agent}i" agent

IncludeOptional conf-enabled/*.conf
IncludeOptional sites-enabled/*.conf

Terus cek file 000-default.conf di folder sites-available jadi gini :

<VirtualHost *:80>
ServerAdmin [email protected]
DocumentRoot /var/www

ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>

cek envvars, sama kaya gini gak :

unset HOME

if [ "${APACHE_CONFDIR##/etc/apache2-}" != "${APACHE_CONFDIR}" ] ; then
SUFFIX="-${APACHE_CONFDIR##/etc/apache2-}"
else
SUFFIX=
fi

export APACHE_RUN_USER=pi
export APACHE_RUN_GROUP=pi

export APACHE_PID_FILE=/var/run/apache2$SUFFIX/apache2.pid
export APACHE_RUN_DIR=/var/run/apache2$SUFFIX
export APACHE_LOCK_DIR=/var/lock/apache2$SUFFIX

export APACHE_LOG_DIR=/var/log/apache2$SUFFIX

export LANG=C

export LANG

Sehabis itu rewrite/beri akses/chown folder www-nya user:group jadi pi:pi

sudo chown -R pi:pi /var/www

sekarang rewrite pakai a2enmod dan sehabis itu Restart Apache2

sudo a2enmod rewrite
sudo service apache2 restart

Untuk PHPnya, cuma cek lewat php.info aja kok, tinggal bikin phpinfonya :

echo "<?php phpinfo ();?>" > /var/www/infoaja.php

Sekarang setting MariaDB SQL-nya

Login mysqlnya dulu tanpa password

sudo mysql -u root -p

sehabis itu bikin password buat si root dan beri akses ke localhost

DROP USER 'root'@'localhost';
CREATE USER 'root'@'localhost' IDENTIFIED BY 'bikin_passwordnya_disini';
GRANT ALL PRIVILEGES ON *.* TO 'root'@'localhost' WITH GRANT OPTION;
  • INGAT, import-export MySQL CLI
    Export pakai mysqldump -u root -p namadatabase > namadatabase.sql
    Import pakai mysql -u root -p namadatabase < namadatabase.sql

Dah selesai


Terakhir, install dan setting phpmyadminnya

sudo apt-get install phpmyadmin -y

user phpmyadmin gak usah ikut dbconfignya, install tanpa phpmyadmin user dan database, udah pake bawaan dari MariaDB aja,

terakhir :

sudo phpenmod mysqli
sudo /etc/init.d/apache2 restart

Selesai, cek di localhost/phpmyadmin

TROUBLESHOOT PHPMYADMIN

Untuk mengatasi blowfish_secret, edit file yang ada di config.default.php

sudo nano /usr/share/phpmyadmin/libraries/config.default.php

dan masukin kalimat panjang bebas terserah

[email protected]

Jika ada error pada ./libraries/sql.lib.php, backup dulu filenya :

sudo cp /usr/share/phpmyadmin/libraries/sql.lib.php /usr/share/phpmyadmin/libraries/sql.lib.php.bak

edit filenya :

sudo nano /usr/share/phpmyadmin/libraries/sql.lib.php

cari script : (count($analyzed_sql_results[‘select_expr’] == 1

dan tambahkan/ganti dengan : ((count($analyzed_sql_results[‘select_expr’]) == 1)


Jika ada error pada ./libraries/plugin_interface.lib.php, biasa, backup dulu file itu dan edit deh

# sudo nano /usr/share/phpmyadmin/libraries/plugin_interface.lib.php

cari script : if ($options != null && count($options) > 0)

terus ganti sama : if (! is_null($options) && count((array)$options) > 0) {

Tags

Related Article

Pradja DJ

M untuk Mini dan W untuk Wumbo

Leave a Reply

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

This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.


Advertisment ad adsense adlogger