vvvvvvvuk
Anonymous
893 x views • 5 years ago
https://ostechnix.com/install-apache-mariadb-php-lamp-stack-ubuntu-16-04/
Ansibel
sudo apt install apache2
sudo systemctl status apache2
sudo ufw app list
Apache
Apache Full
Apache Secure
OpenSSH
As you can see, Apache and OpenSSH applications have installed UFW profiles.
If you look into the “Apache Full” profile, you will see that it enables traffic to the ports 80 and 443:
sudo ufw app info "Apache Full"
Profile: Apache Full
Title: Web Server (HTTP,HTTPS)
Description: Apache v2 is the next generation of the omnipresent Apache web
server.
Ports:
80,443/tcp
sudo ufw allow in "Apache Full"
sudo apt install mariadb-server mariadb-client
sudo apt-get install software-properties-common
sudo apt-key adv --recv-keys --keyserver hkp://keyserver.ubuntu.com:80 0xF1656F24C74CD1D8
sudo add-apt-repository 'deb [arch=amd64,arm64,ppc64el] http://sgp1.mirrors.digitalocean.com/mariadb/repo/10.3/ubuntu bionic main'
sudo apt update
sudo apt install mariadb-server
sudo systemctl status mysql
mysql_secure_installation
Enter current password for root (enter for none):
ERROR 1698 (28000): Access denied for user 'root'@'localhost'
Enter current password for root (enter for none):
You can't login set the password. You will see an error like below.
To fix this problem, log in as MySQL database administrator using command:
sudo mysql -u root
use mysql;
update user set plugin='' where User='root';
flush privileges;
\q
mysql_secure_installation
Enter current password for root (enter for none): # Press ENTER
OK, successfully used password, moving on...
Setting the root password ensures that nobody can log into the MariaDB
root user without the proper authorisation.
Set root password? [Y/n] # Press ENTER...
New password: # Enter password
Re-enter new password: # Re-enter password...
Password updated successfully!
PHP...
sudo apt install php libapache2-mod-php php-mysql
sudo vi /var/www/html/info.php
sudo systemctl restart apache2
sudo apt-cache search php- | less
sudo apt-cache show php-gd
sudo apt install php-gd
To install all modules (not necessary though), run:
sudo apt-get install php*
https://ostechnix.com/install-apache-mariadb-php-lamp-stack-on-arch-linux-2016/
https://ostechnix.com/install-nginx-mariadb-php-lemp-stack-on-arch-linux-2016/
https://www.tecmint.com/install-apache-mariadb-php-phpmyadmin-in-ubuntu-14-10/
sudo hostnamectl set-hostname yourFQDNname
sudo hostnamectl
sudo apt-get update && sudo apt-get upgrade
sudo apt-get install apache2
http://your_server_IP
sudo apt-get install php5 php5-mysql php5-mcrypt php5-gd libapache2-mod-php5
sudo apt-cache search php5
sudo apt-cache show php5-module_name
sudo apt-get install mariadb-client mariadb-server
sudo mysql_secure_installation
mysql -u root -p
sudo apt-get install phpmyadmin
sudo cp /etc/phpmyadmin/apache.conf /etc/apache2/conf-available/phpmyadmin.conf
sudo a2enconf phpmyadmin
sudo service apache2 restart
http://your_server_IP/phpmyadmin
sudo nano /var/www/html/info.php
In order to be sure that Apache and MariaDB services are started after every system reboot, install sysv-rc-conf package that manages Ubuntu init scripts, then enable both services system-wide by running the following commands.
$ sudo apt-get install sysv-rc-conf
$ sudo sysv-rc-conf apache2 on
$ sudo sysv-rc-conf mysql on
https://www.howtoforge.com/tutorial/install-apache-with-php-and-mysql-on-ubuntu-18-04-lamp/
https://www.howtoforge.com/tutorial/install-apache-with-php-and-mysql-on-ubuntu-18-04-lamp/
In this tutorial, I will use the hostname server1.example.com with the IP address 192.168.1.100.
sudo -s
apt-get -y install mysql-server mysql-client
mysql_secure_installation
apt-get -y install mariadb-server mariadb-client
mysql_secure_installation
Enter current password for root (enter for none): <-- press enter
Set root password? [Y/n] <-- y
New password: <-- Enter the new MariaDB root password here
Re-enter new password: <-- Repeat the password
Remove anonymous users? [Y/n] <-- y
Disallow root login remotely? [Y/n] <-- y
Reload privilege tables now? [Y/n] <-- y
mysql -u root -p
apt-get -y install apache2
apt-get -y install php7.2 libapache2-mod-php7.2
systemctl restart apache2
nano /var/www/html/info.php
<?php
phpinfo();
chown www-data:www-data /var/www/html/info.php
As you see, PHP 7.2 is working, and it's working through the Apache 2.0 Handler, as shown in the Server API line. If you scroll further down, you will see all modules that are already enabled in PHP. MySQL is not listed there which means we don't have MySQL / MariaDB support in PHP yet.
Get MySQL / MariaDB support in PHP
To get MySQL support in PHP, we can install the php7.2-mysql package. It's a good idea to install some other PHP modules as well as you might need them for your applications. You can search for available PHP modules like this:
apt-cache search php7.2
apt-cache search php-
as not all PHP packages have the version number 7.2 in their name.
apt-get -y install php7.2-mysql php7.2-curl php7.2-gd php7.2-intl php-pear php-imagick php7.2-imap php-memcache php7.2-pspell php7.2-recode php7.2-sqlite3 php7.2-tidy php7.2-xmlrpc php7.2-xsl php7.2-mbstring php-gettext
systemctl restart apache2
Install the Opcache + APCu PHP cache to speed up PHP
PHP 7 ships with a built-in opcode cacher for caching and optimizing PHP intermediate code, it has the name 'opcache' and is available in the package php7.0-opcache. It is strongly recommended to have an Opcache installed to speed up your PHP page. Besides opcache, I will install APCu which is a compatibility wrapper for opcache to provide the functions of the APC cache, an often used caching system in PHP 5.x versions and many CMS systems still use it.
apt-get -y install php7.2-opcache php-apcu
Don't worry if it shows that Opcache is already installed.
systemctl restart apache2
Enable the SSL website in apache
SSL/ TLS is a security layer to encrypt the connection between the web browser and your server. Most web browsers start to show sites as insecure today when the connection between the server and the web browser is not encrypted with SSL. In this chapter, I will show you how to secure your website with SSL.
Execute the following commands on your server to enable SSL (https://) support. Run:
a2enmod ssl
a2ensite default-ssl
which enables the SSL module and adds a symlink in the /etc/apache2/sites-enabled folder to the file /etc/apache2/sites-available/default-ssl.conf to include it into the active apache configuration. Then restart apache to enable the new configuration:
systemctl restart apache2
apt-get -y install python3-certbot-apache
nano /etc/apache2/sites-available/000-default.conf
ServerName example.com
certbot --apache -d example.com
Accept the terms and conditions of the Let's Encrypt SSL authority.
Then choose if you want to redirect non-SSL requests to https:// automatically. I'll select yes here to avoid duplicate content problems when the website is available as http:// and https:// version.
The SSL certificate has been issued successfully.
When you access the website now with a browser, you will get redirected automatically to SSL and the green padlock in front of the URL bar in the browser shows that we are using a trusted SSL certificate now.
Let's encrypt Auto Renewal
Let's Encrypt SSL certificates are valid for a short period of 80 days only. Therefore a cronjob to auto-renew the SSL certificates is necessary that runs the certbot --renew command.
This cronjob get setup automatically when you install certbot, the cron file is /etc/cron.d/certbot. So there is nothing more to do here. If you like to know what the cronjob looks like, run the command:
/etc/cron.d/certbot
root@server1:~# cat /etc/cron.d/certbot
# /etc/cron.d/certbot: crontab entries for the certbot package
#
# Upstream recommends attempting renewal twice a day
#
# Eventually, this will be an opportunity to validate certificates
# haven't been revoked, etc. Renewal will only occur if expiration
# is within 30 days.
SHELL=/bin/sh
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
0 */12 * * * root test -x /usr/bin/certbot -a \! -d /run/systemd/system && perl -e 'sleep int(rand(43200))' && certbot -q renew
apt-get -y install phpmyadmin
Web server to configure automatically: <-- Select the option: apache2
Configure database for phpmyadmin with dbconfig-common? <-- Yes
MySQL application password for phpmyadmin: <-- Press enter, apt will create a random password automatically.
mysql -u root
CREATE USER 'admin'@'localhost' IDENTIFIED BY 'howtoforge';
GRANT ALL PRIVILEGES ON *.* TO 'admin'@'localhost' WITH GRANT OPTION;
FLUSH PRIVILEGES;
exit
Afterward, you can access phpMyAdmin under http://192.168.1.100/phpmyadmin/:
Virtual machine image download of this tutorial
This tutorial is available as ready to use virtual machine image in ovf/ova format that is compatible with VMWare and Virtualbox. The virtual machine image uses the following login details:
SSH / Shell Login
Username: administrator
Password: howtoforge
This user has sudo rights.
MySQL Login
Username: root
Password: howtoforge
The IP of the VM is 192.168.1.100, it can be changed in the file /etc/network/interfaces. Please change all the above passwords to secure the virtual machine.
Apache: http://httpd.apache.org/
PHP: http://www.php.net/
MySQL: http://www.mysql.com/
MariaDB: https://mariadb.com/
Ubuntu: http://www.ubuntu.com/
phpMyAdmin: http://www.phpmyadmin.net/
---------------------
https://www.digitalocean.com/community/tutorials/how-to-install-linux-apache-mysql-php-lamp-stack-on-ubuntu-20-04-id
https://www.digitalocean.com/community/tutorials/how-to-install-linux-apache-mysql-php-lamp-stack-on-ubuntu-20-04-id
Menginstal Apache dan Memperbarui Firewall
sudo apt update
sudo apt install apache2
Setelah instalasi selesai, Anda akan perlu menyesuaikan pengaturan firewall Anda untuk memperbolehkan lalu lintas HTTP. UFW memiliki berbagai profil aplikasi berbeda yang dapat Anda manfaatkan untuk menyelesaikannya. Untuk mendapatkan daftar semua profil aplikasi UFW yang tersedia, Anda dapat menjalankan:
sudo ufw app list
Berikut adalah makna dari setiap profil ini:
Apache: Profil ini hanya membuka porta 80 (lalu lintas web normal dan tidak terenkripsi).
Apache Full: Profil ini membuka baik porta 80 (lalu lintas web normal dan tidak terenkripsi) dan
porta 443 (lalu lintas terenkripsi TLS/SSL).
Apache Secure: Profile ini hanya membuka porta 443 (lalu lintas terenkripsi TLS/SSL).
Untuk saat ini, sebaiknya izinkan hanya koneksi pada porta 80, karena ini adalah instalasi Apache yang baru dan Anda belum memiliki sertifikat TLS/SSL yang dikonfigurasi untuk mengizinkan lalu lintas HTTPS di server Anda.
sudo ufw allow in "Apache"
sudo ufw status
http://your_server_ip
Cara Menemukan Alamat IP Publik Server Anda
Jika Anda tidak mengetahui alamat IP publik server Ada, ada sejumlah cara untuk mengetahuinya. Biasanya, ini adalah alamat yang digunakan untuk terhubung ke server Anda melalui SSH.
Ada beberapa cara untuk melakukannya dari baris perintah. Pertama, Anda dapat menggunakan alat iproute2 untuk mengetahui alamat IP dengan mengetik ini:
ip addr show eth0 | grep inet | awk '{ print $2; }' | sed 's/\/.*$//'
Ini akan menampilkan dua atau tiga baris tanggapan. Semua adalah alamat yang benar, tetapi komputer Anda mungkin hanya dapat menggunakan salah satunya, jadi silakan mencoba masing-masing alamat itu.
Cara alternatifnya adalah menggunakan utilitas curl untuk menghubungi pihak luar supaya memberitahukan bagaimana pihak luar melihat server Anda. Hal ini dilakukan dengan menanyakan alamat IP Anda kepada server tertentu:
curl http://icanhazip.com
Terlepas dari cara yang digunakan untuk mengetahui alamat IP Anda, ketik alamat IP pada bilah alamat di peramban web Anda untuk melihat laman Apache asali.
sudo apt install mysql-server
sudo mysql_secure_installation
Anda akan ditanya apakah Anda ingin mengonfigurasi VALIDATE PASSWORD PLUGIN.
Catatan: Mengaktifkan fitur ini merupakan keputusan yang Anda pertimbangkan sendiri. Jika diaktifkan, kata sandi yang tidak cocok dengan kriteria yang ditentukan akan ditolak oleh MySQL dengan suatu kesalahan. Akan lebih aman jika Anda tetap menonaktifkan validasi, tetapi Anda harus selalu menggunakan kata sandi yang kuat dan unik untuk kredensial basis data.
Jawab Y untuk ya, atau jawaban lain untuk melanjutkan tanpa mengaktifkan.
VALIDATE PASSWORD PLUGIN can be used to test passwords
and improve security. It checks the strength of password
and allows the users to set only those passwords which are
secure enough. Would you like to setup VALIDATE PASSWORD plugin?
Press y|Y for Yes, any other key for No:
Jika Anda menjawab “ya”, Anda akan diminta untuk memilih tingkat validasi kata sandi. Harap ingat bahwa jika Anda memasukkan 2 sebagai tingkat terkuat, Anda akan menjumpai kesalahan saat berusaha menentukan kata sandi yang tidak mengandung angka, huruf kapital dan huruf kecil, serta karakter khusus, atau kata sandi yang berdasarkan pada kata-kata kamus umum.
There are three levels of password validation policy:
LOW Length >= 8
MEDIUM Length >= 8, numeric, mixed case, and special characters
STRONG Length >= 8, numeric, mixed case, special characters and dictionary file
Please enter 0 = LOW, 1 = MEDIUM and 2 = STRONG: 1
Terlepas dari pilihan pengaturan VALIDATE PASSWORD PLUGIN, server Anda akan meminta Anda untuk memilih dan mengonfirmasi kata sandi untuk pengguna root MySQL. Ini tidak sama dengan root sistem. Pengguna root basis data adalah pengguna administratif dengan privilese penuh terhadap sistem basis data. Meskipun metode autentikasi asali untuk pengguna root MySQL mengecualikan penggunaan kata sandi, sekalipun kata kata sandi sudah dibuat, Anda tetap harus menentukan kata sandi yang kuat di sini sebagai langkah keamanan tambahan. Kita akan membahas hal ini sebentar lagi.
Jika Anda mengaktifkan validasi kata sandi, Anda akan diperlihatkan kekuatan kata sandi untuk kata sandi root yang baru saja Anda masukkan dan server Anda akan bertanya apakah Anda ingin melanjutkan dengan kata sandi itu. Jika Anda puas dengan kata sandi ini, tekan Y untuk “ya” di prompt:
Estimated strength of the password: 100
Do you wish to continue with the password provided?(Press y|Y for Yes, any other key for No) : y
Untuk pertanyaan lainnya, tekan Y dan tombol ENTER pada setiap pertanyaan. Ini akan menghapus sebagian pengguna anonim dan basis data percobaan, menonaktifkan log masuk root dari jarak jauh, dan memuat aturan-aturan baru ini sehingga MySQL segera menerapkan perubahan yang Anda buat.
Setelah Anda selesai, lakukan percobaan apakah Anda dapat melakukan log masuk ke konsol MySQL dengan mengetik:
sudo mysql
exit
Anda juga akan memerlukan libapache2-mod-php untuk memungkinkan Apache menangani berkas PHP. Paket PHP inti akan secara otomatis terinstal sebagai dependensi.
sudo apt install php libapache2-mod-php php-mysql
php -v
Menciptakan Hos Virtual untuk Situs Web Anda
Ketika menggunakan server web Apache, Anda bisa menciptakan hos virtual (serupa dengan blok server di Nginx) untuk merangkum detail konfigurasi dan menjadi hos dari lebih dari satu domain dari server tunggal. Dalam panduan ini, kita akan menyiapkan domain bernama your_domain, tetapi Anda harus menggantinya dengan nama domain Anda sendiri.
Catatan: Jika Anda menggunakan DigitalOcean sebagai penyedia hos DNS, lihat dokumen produk kami untuk instruksi mendetail tentang cara mempersiapkan nama domain baru dan mengarahkannya ke server Anda.
Apache pada Ubuntu 20.04 memiliki satu blok server yang aktif secara asali, yang dikonfigurasi untuk menyajikan dokumen-dokumen dari direktori /var/www/html. Meskipun ini berfungsi baik untuk situs tunggal, ini bisa menjadi sulit dijalankan jika Anda menjadi hos dari beberapa situs. Alih-alih memodifikasi /var/www/html, kita akan menciptakan suatu struktur direktori dalam /var/www untuk situs your_domain, dengan membiarkan /var/www/html sebagai direktori asali yang akan ditampilkan jika permintaan klien tidak cocok dengan situs lain.
Buat direktori untuk your_domain sebagai berikut:
sudo mkdir /var/www/your_domain
Selanjutnya, tentukan kepemilikan direktori dengan variabel lingkungan $USER, yang akan merujuk pada pengguna sistem Anda saat ini:
sudo chown -R $USER:$USER /var/www/your_domain
Kemudian, buka berkas konfigurasi baru dalam direktori sites-available Apache dengan menggunakan editor baris perintah yang Anda sukai. Di sini, kita akan menggunakan nano:
sudo nano /etc/apache2/sites-available/your_domain.conf
Ini akan menciptakan berkas kosong yang baru. Tempelkan konfigurasi dasar berikut:
/etc/apache2/sites-available/your_domain.conf
<VirtualHost *:80>
ServerName your_domain
ServerAlias www.your_domain
ServerAdmin webmaster@localhost
DocumentRoot /var/www/your_domain
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
Dengan konfigurasi VirtualHost ini, kita menyuruh Apache untuk menyajikan your_domain menggunakan /var/www/your_domain sebagai direktori root web. Jika Anda ingin menguji Apache tanpa nama domain, Anda dapat menghapus atau memberikan komentar pada opsi ServerName dan ServerAlias dengan menambahkan karakter # di depan masing-masing baris opsi.
Anda dapat menggunakan a2ensite untuk mengaktifkan hos virtual yang baru:
sudo a2ensite your_domain
Anda mungkin ingin menonaktifkan situs web asali yang terinstal dengan Apache. Ini diperlukan jika Anda tidak menggunakan nama domain khusus, karena dalam hal ini, konfigurasi asali Apache akan menimpa hos virtual Anda. Untuk menonaktifkan situs web asali Apache, ketikkan:
sudo a2dissite 000-default
Untuk memastikan berkas konfigurasi Anda tidak berisi kesalahan sintaks, jalankan:
sudo apache2ctl configtest
Terakhir, muat ulang Apache agar perubahan ini diterapkan:
sudo systemctl reload apache2
Situs web Anda yang baru kini sudah aktif, tetapi root web /var/www/your_domain masih kosong.
Buat berkas index.html di dalam lokasi itu sehingga kita dapat menguji apakah hos virtual bekerja sesuai harapan:
nano /var/www/your_domain/index.html
Sertakan konten berikut di dalam berkas ini:
<html>
<head>
<title>your_domain website</title>
</head>
<body>
<h1>Hello World!</h1>
<p>This is the landing page of <strong>your_domain</strong>.</p>
</body>
</html>
Anda dapat meninggalkan berkas ini di lokasinya saat ini sebagai laman landas sementara untuk aplikasi Anda sampai Anda menyiapkan berkas index.php untuk menggantinya. Setelah Anda melakukannya, ingat untuk menghapus atau mengganti nama berkas index.html dari root dokumen Anda, karena berkas ini lebih diutamakan daripada berkas index.php secara asali.
Catatan Tentang DirectoryIndex pada Apache
Dengan pengaturan DirectoryIndex asali pada Apache, berkas yang diberi nama index.html akan selalu lebih diutamakan daripada berkas index.php. Ini berguna untuk menyiapkan laman pemeliharaan di aplikasi PHP, dengan menciptakan berkas index.html sementara yang mengandung suatu pesan informatif bagi pengunjung. Karena lebih diutamakan daripada laman index.php, laman ini akan menjadi laman landas untuk aplikasi. Setelah pemeliharaan selesai, index.html diubah namanya atau dihapus dari root dokumen, sehingga mengembalikan laman aplikasi reguler.
sudo nano /etc/apache2/mods-enabled/dir.conf
<IfModule mod_dir.c>
DirectoryIndex index.php index.html index.cgi index.pl index.xhtml index.htm
</IfModule>
sudo systemctl reload apache2
sudo rm /var/www/your_domain/info.php
Menguji Koneksi Basis Data dari PHP (Opsional)
Saat menyusun tulisan ini, pustaka PHP MySQL asli mysqlndtidak mendukung caching_sha2_authentication, metode autentikasi asali untuk MySQL 8. Kita akan perlu menciptakan pengguna baru dengan metode autentikasi mysql_native_password agar dapat terhubung ke basis data MySQL dari PHP.
Kita akan menciptakan basis data bernama example_database dan pengguna bernama example_user, tetapi Anda dapat mengganti nama-nama ini dengan nilai yang berbeda.
Pertama, hubungkan ke konsol MySQL menggunakan akun root:
sudo mysql
CREATE DATABASE example_database;
CREATE USER 'example_user'@'%' IDENTIFIED WITH mysql_native_password BY 'password';
GRANT ALL ON example_database.* TO 'example_user'@'%';
exit
mysql -u example_user -p
CREATE TABLE example_database.todo_list (
item_id INT AUTO_INCREMENT,
content VARCHAR(255),
PRIMARY KEY(item_id)
);
INSERT INTO example_database.todo_list (content) VALUES ("My first important item");
SELECT * FROM example_database.todo_list;
nano /var/www/your_domain/todo_list.php
<?php
$user = "example_user";
$password = "password";
$database = "example_database";
$table = "todo_list";
try {
$db = new PDO("mysql:host=localhost;dbname=$database", $user, $password);
echo "<h2>TODO</h2><ol>";
foreach($db->query("SELECT content FROM $table") as $row) {
echo "<li>" . $row['content'] . "</li>";
}
echo "</ol>";
} catch (PDOException $e) {
print "Error!: " . $e->getMessage() . "<br/>";
die();
}
http://your_domain_or_IP/todo_list.php
https://httpd.apache.org/docs/current/vhosts/
https://www.howtoforge.com/tutorial/ubuntu-lts-minimal-server/
Preliminary Note
In this tutorial, I use the hostname server1.example.com with the IP address 192.168.0.100 and the gateway 192.168.0.1 These settings might differ for you, so you have to replace them where appropriate.
........
https://www.niagahoster.co.id/blog/cara-install-lemp-di-ubuntu/
LEMP adalah singkatan dari Linux, Nginx, MariaDB, dan PHP. Fungsi LEMP adalah untuk membuat server website dan membantu agar aplikasi menjadi dinamis. Fungsinya sama seperti dengan XAMPP yang ada di sistem operasi Windows.
Langkah 1 : Menginstall Nginx dan Memperbarui Firewall
Nginx adalah web server HTTP dan proxy dengan kode open source yang bisa juga berfungsi sebagai proxy IMAP/POP3. Kenapa menggunakan Nginx? Karena Nginx menawarkan penggunaan memori yang kecil dengan konkurensi yang tinggi. Sehingga akan mempercepat Anda dalam menyelesaikan semua proses di server. Berikut ini adalah langkah-langkah cara update CentOS 7 dan install Nginx.
sudo apt-get update && apt-get upgrade
sudo apt-get install nginx
Terkadang, dalam beberapa kasus halaman default Nginx tidak muncul. Ini dapat disebabkan oleh pengaturan firewall yang diterapkan pada server. Untuk menanggulangi hal ini, Anda perlu install UFW guna mengatur Nginx agar menerima permintaan web pada port 80 dan port 443 di firewall. Oleh karena itu, langkah selanjutnya kami akan memberikan panduan instalasi UFW.
Install UFW
Uncomplicated Firewall (UFW) merupakan kumpulan perintah yang digunakan untuk konfigurasi iptables di Ubuntu. UFW sudah tersedia di Ubuntu dan secara default sudah terinstall di dalamnya.
Untuk melakukan instalasi UFW, gunakan perintah berikut.
sudo apt-get install ufw
Setelah itu, berikan izin pada traffic HTTP dan HTTPS agar bisa melewati firewall
sudo ufw allow http
sudo ufw allow https
ufw –help
sudo systemctl restart nginx
sudo systemctl status nginx
sudo apt install mariadb-server
sudo mysql_secure_installation
Keempat, Anda akan diminta untuk membatasi akses root dari localhost saja. Ini untuk memperkecil kemungkinan orang lain menebak kata sandi root Anda. Klik Y untuk membatasi root di localhost.
sudo mariadb
GRANT ALL ON *.* TO 'admin'@'localhost' IDENTIFIED BY 'admin1234' WITH GRANT OPTION;
FLUSH PRIVILEGES;
exit;
mariadb -u admin -p
sudo apt install php-fpm php-mysql
https://www.niagahoster.co.id/blog/cara-install-wordpress-menggunakan-nginx-di-centos-7/
https://www.niagahoster.co.id/blog/cara-install-wordpress-menggunakan-nginx-di-ubuntu/
https://www.niagahoster.co.id/blog/cara-install-lemp-di-debian/
https://langittutorial.blogspot.com/2017/12/cara-install-dan-menggunakan-respin-remastering-tool-ubuntu-16.html
https://storage.googleapis.com/kubernetes-release/release/stable.txt
https://musaamin.web.id/cara-install-dan-setting-xampp-for-linux/
https://musaamin.web.id/cara-install-dan-setting-xampp-for-linux/
https://langittutorial.blogspot.com/2017/12/cara-install-dan-menggunakan-respin-remastering-tool-ubuntu-16.html
https://musaamin.web.id/cara-install-nextcloud-client-ubuntu/
https://musaamin.web.id/cara-install-nextcloud-client-ubuntu/
https://musaamin.web.id/cara-install-mysql55-ubuntu1804/
groupadd mysql
useradd -g mysql mysql
tar xzvf mysql-5.5.62-linux-glibc2.12-x86_64.tar.gz
mv mysql-5.5.62-linux-glibc2.12-x86_64 /usr/local/mysql
cd /usr/local/mysql
chown -R mysql:mysql *
Install paket dependensi libaio1.
apt install libaio1
scripts/mysql_install_db --user=mysql
cp support-files/my-medium.cnf /etc/my.cnf
Copy file konfigurasi service mysql-server.
bin/mysqld_safe --user=mysql &
cp support-files/mysql.server /etc/init.d/mysql.server
bin/mysqladmin -u root password 'rahasia'
ln -s /usr/local/mysql/bin/mysql /usr/local/bin/mysql
reboot
update-rc.d -f mysql.server defaults
/etc/init.d/mysql.server start
/etc/init.d/mysql.server status
mysql -u root -p
https://www.youtube.com/c/musaamin/videos
https://www.youtube.com/c/musaamin/videos
install lampp
sudo /opt/lampp/lampp start
Starting XAMPP for Linux 7.2.18-1...
XAMPP: Starting Apache...fail.
XAMPP: Another web server is already running.
XAMPP: Starting MySQL...ok.
XAMPP: Starting ProFTPD...ok.
sudo systemctl stop apache2
sudo systemctl disable apache2
sudo systemctl stop mysql
sudo systemctl disable mysql
File konfigurasi XAMPP:
Apache configuration file: /opt/lampp/etc/httpd.conf, /opt/lampp/etc/extra/httpd-xampp.conf
PHP configuration file: /opt/lampp/etc/php.ini
MySQL configuration file: /opt/lampp/etc/my.cnf
ProFTPD configuration file: /opt/lampp/etc/proftpd.conf
Direktori penting XAMPP:
Direktori Document Root: /opt/lampp/htdocs
Direktori database: /opt/lampp/var/mysql
Direktori konfigurasi: /opt/lampp/etc
cd /opt/lampp/htdocs
sudo mkdir webku.com
sudo chown $USER.$USER webku.com
sudo gedit /opt/lampp/etc/httpd.conf
# Virtual hosts
#Include etc/extra/httpd-vhosts.conf
TO.....
# Virtual hosts
Include etc/extra/httpd-vhosts.conf
Selanjutnya buka file konfigurasi virtual hosts httpd-vhosts.conf .....
sudo gedit /opt/lampp/etc/extra/httpd-vhosts.conf
Before ...
<VirtualHost *:80>
ServerAdmin [email protected]
DocumentRoot "/opt/lampp/docs/dummy-host.example.com"
ServerName dummy-host.example.com
ServerAlias www.dummy-host.example.com
ErrorLog "logs/dummy-host.example.com-error_log"
CustomLog "logs/dummy-host.example.com-access_log" common
</VirtualHost>
<VirtualHost *:80>
ServerAdmin [email protected]
DocumentRoot "/opt/lampp/docs/dummy-host2.example.com"
ServerName dummy-host2.example.com
ErrorLog "logs/dummy-host2.example.com-error_log"
CustomLog "logs/dummy-host2.example.com-access_log" common
</VirtualHost>
AFTER ...
<VirtualHost *:80>
ServerName localhost
DocumentRoot /opt/lampp/htdocs
ErrorLog "logs/localhost.error.log"
CustomLog "logs/localhost.access.log" common
</VirtualHost>
<VirtualHost *:80>
ServerName webku.com
DocumentRoot /opt/lampp/htdocs/webku.com
ErrorLog "logs/webku.com.error.log"
CustomLog "logs/webku.com.access.log" common
</VirtualHost>
sudo gedit /etc/hosts
127.0.0.1 webku.com
sudo /opt/lampp/lampp reloadapache
https://musaamin.web.id/cara-install-dan-setting-xampp-for-linux/
https://musaamin.web.id/cara-install-dan-setting-xampp-for-linux/
https://musaamin.web.id/cara-install-sistem-informasi-desa-opensid-di-ubuntu-18-04/
https://musaamin.web.id/cara-install-sistem-informasi-desa-opensid-di-ubuntu-18-04/
sudo apt install apache2 -y
cd /etc/apache2/sites-available
sudo nano desaindah.id.conf
<VirtualHost *:80>
ServerName www.desaindah.id
ServerAlias desaindah.id
DocumentRoot /var/www/desaindah.id
<Directory /var/www/desaindah.id>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Require all granted
</Directory>
ErrorLog /var/log/apache2/desaindah.id.error.log
CustomLog /var/log/apache2/desaindah.id.access.log combined
</VirtualHost>
sudo a2ensite desaindah.id.conf
sudo a2enmod rewrite
sudo systemctl restart apache2
sudo systemctl status apache2
cd /var/www
sudo mkdir desaindah.id
sudo nano desaindah.id/test.html
sudo rm /var/www/desaindah.id/test.html
sudo apt install php php-common php-mysql php-gd php-cli libapache2-mod-php -y
sudo apt install mariadb-server mariadb-client -y
sudo mysql_secure_installation
Enter current password for root (enter for none): ENTER
Set root password? [Y/n] y
New password: PASSWORD_ROOT
Re-enter new password: MASUKKAN_ULANG_PASSWORD_ROOT
Remove anonymous users? [Y/n] y
Disallow root login remotely? [Y/n] y
Remove test database and access to it? [Y/n] y
Reload privilege tables now? [Y/n] y
sudo mysql -u root -p
create database opensid;
create user 'user_opensid'@'localhost' identified by 'pass_opensid';
grant all privileges on opensid.* to 'user_opensid'@'localhost';
flush privileges;
wget https://github.com/OpenSID/OpenSID/archive/v19.07.zip -O OpenSID-v19.07.zip
unzip OpenSID*.zip
sudo cp -Rv OpenSID-19.07/* /var/www/desaindah.id/
cd /var/www/desaindah.id
sudo cp -Rv desa-contoh desa
sudo chown -R $USER:www-data ../desaindah.id
sudo chmod -R 775 ../desaindah.id
mysql -u user_opensid -p opensid < desaindah.id/contoh_data_awal_20190701.sql
nano desa/config/database.php
$db['default']['hostname'] = 'localhost';
$db['default']['username'] = 'user_opensid';
$db['default']['password'] = 'pass_opensid';
$db['default']['database'] = 'opensid';
Akses laman admin OpenSID http://desaindah.id/index.php/siteman, username = admin, password = sid304.
https://github.com/OpenSID/OpenSID
https://github.com/OpenSID/OpenSID/wiki
https://demo.opensid.or.id/
https://www.facebook.com/groups/opensid
https://www.howtoforge.com/tutorial/ubuntu-lts-minimal-server/
https://www.howtoforge.com/tutorial/ubuntu-lts-minimal-server/
https://www.howtoforge.com/ubuntu_lamp_for_newbies
sudo apt-get install apache2
http://localhost/
sudo apt-get install php5 libapache2-mod-php5
sudo /etc/init.d/apache2 restart
sudo gedit /var/www/testphp.php
<?php phpinfo(); ?>
sudo apt-get install mysql-server
gksudo gedit /etc/mysql/my.cnf
bind-address = 127.0.0.1
mysql -u root
mysql> SET PASSWORD FOR 'root'@'localhost' = PASSWORD('yourpassword');
sudo apt-get install libapache2-mod-auth-mysql php5-mysql phpmyadmin
gksudo gedit /etc/php5/apache2/php.ini
;extension=mysql.so
extension=mysql.so
sudo /etc/init.d/apache2 restart
https://www.digitalocean.com/community/tutorials/how-to-install-linux-apache-mariadb-php-lamp-stack-debian9
https://www.digitalocean.com/community/tutorials/how-to-install-linux-apache-mariadb-php-lamp-stack-debian9
sudo apt update
sudo apt install apache2
sudo ufw app list
sudo ufw app info "WWW Full"
sudo ufw allow in "WWW Full"
ip addr show eth0 | grep inet | awk '{ print $2; }' | sed 's/\/.*$//'
sudo apt install curl
curl http://icanhazip.com
sudo apt install mariadb-server
sudo mysql_secure_installation
sudo mariadb
GRANT ALL ON *.* TO 'admin'@'localhost' IDENTIFIED BY 'password' WITH GRANT OPTION;
FLUSH PRIVILEGES;
exit
mariadb -u admin -p
sudo apt install php libapache2-mod-php php-mysql
sudo nano /etc/apache2/mods-enabled/dir.conf
/etc/apache2/mods-enabled/dir.conf
<IfModule mod_dir.c>
DirectoryIndex index.html index.cgi index.pl index.php index.xhtml index.htm
</IfModule>
sudo systemctl restart apache2
apt search php- | less
apt show package_name
apt show php-cli
sudo apt install php-cli
sudo apt install package1 package2 ...
sudo nano /var/www/html/info.php
http://your_server_ip/info.php
sudo rm /var/www/html/info.php
https://medium.com/@dataq/instalasi-linux-apache-mysql-php-lamp-stack-pada-ubuntu-16-04-b243d3048b35
https://medium.com/@dataq/instalasi-php-apache-module-pada-ubuntu-16-04-481d288a909d
https://medium.com/@dataq/instalasi-apache-dan-php-fpm-pada-ubuntu-16-04-cd8900b5d529
1. Instalasi Apache
$ sudo apt update
$ sudo apt install apache2
alamat IP atau alamat domain server anda tersebut, misalkan http://mydomain.com/ atau http://104.16.123.127/.
Konfig firewall
sudo ufw app list
sudo ufw app info "Apache Full"
Untuk mengijinkan incoming packet dengan port dan protocol dalam application profile Apache Full, jalankan perintah:
sudo ufw allow in "Apache Full"
Jangan lupa untuk mengijinkan pula incoming packet dengan application profile OpenSSH dengan perintah:
sudo ufw allow in "OpenSSH"
$ sudo ufw status
$ sudo ufw enable
3. Menyembunyikan Informasi Terkait Apache
Menyembunyikan informasi terkait web server Apache, seperti versi Apache dan sistem operasi, sebenarnya bersifat optional karena informasi tersebut bukanlah sebuah vulnerability. Namun menyembunyikan informasi ini adalah langkah pencegahan untuk mempersulit penyerang dalam menemukan vulnerability yang ada pada aplikasi yang terpasang pada server.
Ada dua konfigurasi Apache yang perlu kita ubah, yaitu ServerSignature dan ServerTokens. Bukalah file /etc/apache2/conf-available/security.conf kemudian ubahlah konfigurasiServerTokensmenjadi:
ServerTokens Prod
dan konfigurasi ServerSignature menjadi:
ServerSignature Off
Simpan perubahan tersebut lalu restart service Apache dengan perintah:
$ sudo systemctl restart apache2.service
https://medium.com/tag/web-server
https://medium.com/tag/web-server
https://blog.panoply.io/a-comparative-vmariadb-vs-mysql
sudo apt-get update
sudo apt-get install mysql-server
mysql_secure_installation
mysql -u root -p
https://akaabachi.medium.com/respect-of-the-kill-how-to-properly-terminate-your-linux-processes-99f6025f2e53
$ sudo apt-get update
$ sudo apt-get install mariadb-server
$ sudo mysql_secure_installation
Secara default user root menggunakan unix_socket untuk autentikasi, sehingga kita dapat login menggunakan user root tanpa password. Anda cukup menekan enter ketika anda diminta memasukkan current password for root. Anda juga tidak perlu merubah password root ketika menemui opsi Set root password?. Jawablah tiap pertanyaan pada yang muncul sesuai dengan tingkat keamanan yang anda inginkan. Berikut adalah contoh konfigurasi yang saya rekomendasikan:
NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MariaDB SERVERS IN PRODUCTION USE! PLEASE READ EACH STEP CAREFULLY!In order to log into MariaDB to secure it, we'll need the current
password for the root user. If you've just installed MariaDB, and
you haven't set the root password yet, the password will be blank,
so you should just press enter here.Enter current password for root (enter for none):
OK, successfully used password, moving on...Setting the root password ensures that nobody can log into the MariaDB
root user without the proper authorisation.Set root password? [Y/n] n
... skipping.By default, a MariaDB installation has an anonymous user, allowing anyone
to log into MariaDB without having to have a user account created for
them. This is intended only for testing, and to make the installation
go a bit smoother. You should remove them before moving into a
production environment.Remove anonymous users? [Y/n] Y
... Success!Normally, root should only be allowed to connect from 'localhost'. This
ensures that someone cannot guess at the root password from the network.Disallow root login remotely? [Y/n] Y
... Success!By default, MariaDB comes with a database named 'test' that anyone can
access. This is also intended only for testing, and should be removed
before moving into a production environment.Remove test database and access to it? [Y/n] Y
- Dropping test database...
... Success!
- Removing privileges on test database...
... Success!Reloading the privilege tables will ensure that all changes made so far
will take effect immediately.Reload privilege tables now? [Y/n] Y
... Success!Cleaning up...All done! If you've completed all of the above steps, your MariaDB
installation should now be secure.Thanks for using MariaDB!
. Mengecek Hasil Instalasi MariaDB
Setelah anda selesai melakukan instalasi program tersebut anda dapat mengecek koneksi ke database dengan perintah:
$ sudo mysql
Menambahkan Administrator User
Saran saya, anda perlu menambahkan user selain root untuk melakukan administrasi database MariaDB anda, dan tentunya user tersebut dilengkapi dengan password. Tujuannya agar user yang tidak memiliki hak aksessudo tetap dapat mengelola MariaDB. Langkah pertama, anda perlu masuk ke dalam terminal MariaDB dengan perintah
$ sudo mysql
Buatlah user baru disertai dengan domain. Bila user tersebut hanya boleh mengakses di komputer yang sama, maka tambahkah @localhost di belakang username, misalnya
CREATE USER 'admin'@'localhost' IDENTIFIED BY 'difficultpassword';
Berikan hal akses administrator dengan perintah
GRANT ALL PRIVILEGES ON *.* TO 'admin'@'localhost' WITH GRANT OPTION;
lalu flush privilege
FLUSH PRIVILEGES;
Keluarlah dari terminal MariaDB dengan perintah exit. Kemudian login kembali dengan user baru tersebut tanpa sudo
$ mysql -u admin -p
3. Instalasi PHP
Ada dua pilihan instalasi PHP, yaitu instalasi PHP sebagai bagian dari Apache Module atau instalasi PHP menggunakan PHP-FPM yang terpisah dari Apache. Masing-masing memiliki keunggulan dan kelemahan sendiri. Dari segi kemudahan, instalasi PHP sebagai bagian dari Apache Module memang lebih mudah, namun dari segi fleksibilitas PHP-FPM lebih unggul. Sebagai contoh, kita dapat melakukan instalasi beberapa versi PHP dalam satu server sekaligus menggunakan PHP-FPM.
Opsi 1: PHP Menggunakan Apache Module
Bila anda telah memutuskan untuk menggunakan PHP dalam Apache Module, maka anda dapat mengikuti tutorial yang saya tuliskan pada artikel berikut
https://medium.com/@dataq/instalasi-php-apache-module-pada-ubuntu-16-04-481d288a909d
1. Instalasi PHP Apache Module
PHP dapat dipasang sebagai bagian dari Apache module. Cara ini adalah cara yang paling mudah dalam mengkombinasikan web server Apache dan PHP. Namun konsekuensinya adalah PHP akan mewarisi permission dari proses Apache. Hal ini tentunya akan berdampak pada aspek keamanan pada server anda. Lebih lanjut tentang aspek keamanan ini dapat anda baca pada PHP manual berikut
Langkah pertama dalam melakukan instalasi PHP sebagai bagian dari Apache module adalah dengan menjalankan perintah
$ sudo apt update
$ sudo apt install php libapache2-mod-php
Untuk mengecek apakah PHP telah berjalan di server anda, anda dapat membuat sebuah file dengan isi
<?php
phpinfo();
?>
di root directory server yang secara default berada di /var/www/html/, misalkan dengan nama file /var/www/html/info.php.
Default owner directory /var/www/html/ adalah root, sehingga anda memerlukan hak akses root untuk membuat atau memodifikasi file dalam directory tersebut.
Kemudian cobalah akses file tersebut menggunakan web browser, misalnya dengan mengakses http://<domain server anda>/info.php atau http://<alamat IP server anda>/info.php. Bila anda mendapatkan output seperti pada Gambar 1 berarti proses instalasi PHP telah berhasil.
Pada Ubuntu 16.04 versi PHP yang digunakan adalah versi 7.0. Bila anda memerlukan versi lama atau versi lebih baru, maka anda harus menggunakan cara yang berbeda yang tidak dibahas dalam artikel ini.
Modifikasi Konfigurasi PHP
Tanpa langkah berikut, sebenarnya instalasi PHP tersebut telah dapat digunakan, namun kadang kita perlu melakukan beberapa modifikasi untuk menyesuaikan dengan kebutuhan program PHP yang nantinya kita buat.
Instalasi MySQL module
Bila anda ingin menggunakan PHP untuk mengolah RDBMS MySQL atau MariaDB, maka anda perlu mengaktifkan PHP MySQL module dengan cara menjalankan perintah
$ sudo apt install php-mysql
$ sudo systemctl restart apache2.service
<?php
$servername = "localhost";
$username = "root";
$password = "secret";
$conn = new mysqli($servername, $username, $password);
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
} else {
echo("Connection success.");
}
$conn->close();
?>
Kemudian akses file tersebut menggunakan web browser, misalnya dengan mengakses http://<domain server anda>/mysql.php atau http://<alamat IP server anda>/mysql.php. Jangan lupa, anda perlu mengganti $servername, $username, dan $password pada script untuk disesuaikan dengan konfigurasi server anda. Bila output script tersebut adalah
Connection success.
maka instalasi anda berhasil, namun bila tidak maka berarti ada masalah dengan proses instalasi yang anda lakukan.
Pencarian dan Instalasi Berbagai Modul PHP
Untuk meningkatkan fungsionalitas dari PHP, anda dapat menambahkan beberapa modul tambahan ke dalam PHP. Untuk mencari modul-modul yang tersedia dalam repository, gunakanlah perintah
$ sudo apt-cache search php-
Bila anda ingin pencarian yang lebih spesifik, kombinasikan dengan perintah grep, misalnya anda ingin mencari modul PHP yang berkaitan dengan zip, maka anda dapat menggunakan perintah
$ sudo apt-cache search php- | grep zip
Contoh output dari perintah tersebut adalah
libphp-pclzip - transitional dummy package
php-bz2 - bzip2 module for PHP [default]
php-pclzip - ZIP archive manager class for PHP
php-zip - Zip module for PHP [default]
php-zipstreamer - Stream zip files without i/o overhead
php7.0-bz2 - bzip2 module for PHP
php7.0-zip - Zip module for PHP
Bila anda sudah memutuskan modul apa yang perlu anda install, misalnya php-zip, maka gunakan perintah apt install untuk melakukan instalasi PHP modul tersebut. Berikut adalah contoh perintah untuk melakukan instalasi modul php-zip
$ sudo apt install php-zip
Kemudian restart service Apache dengan perintah
$ sudo systemctl restart apache2.service
Menyembunyikan Versi PHP pada HTTP Header
Bila anda tidak menginginkan versi PHP anda tampil pada HTTP Header, demi alasan keamanan misalnya, maka anda dapat memodifikasi file /etc/php/7.0/apache2/php.ini dan /etc/php/7.0/cli/php.ini. Pastikan variable expose_php pada kedua file tersebut bernilai Off seperti ini.
expose_php = Off
Kemudian restart service Apache dengan perintah
$ sudo systemctl restart apache2.service
Mengganti Default Directory Index
Bila anda memiliki dua file index, misalnya index.html dan index.php, dalam satu directory yang sama, maka yang dieksekusi oleh Apache adalah file index.html. Bila anda ingin mengubah urutan prioritas file index, maka anda dapat mengaturnya melalui file /etc/apache2/mods-available/dir.conf.
Ubahlah urutan index.php pada DirectoryIndex yang semula pada urutan keempat seperti ini
<IfModule mod_dir.c>
DirectoryIndex index.html index.cgi index.pl index.php index.xhtml index.htm
</IfModule>
menjadi urutan pertama seperti ini
<IfModule mod_dir.c>
DirectoryIndex index.php index.html index.cgi index.pl index.xhtml index.htm
</IfModule>
Kemudian restart service Apache dengan perintah
sudo systemctl restart apache2.service
https://medium.com/@dataq/instalasi-apache-dan-php-fpm-pada-ubuntu-16-04-cd8900b5d529
https://medium.com/@dataq/instalasi-apache-dan-php-fpm-pada-ubuntu-16-04-cd8900b5d529
Instalasi Apache dan PHP-FPM pada Ubuntu 16.04
Mahendra Data
Mahendra Data
Jun 13, 2018·4 min read
PHP-FPM (FastCGI Process Manager) adalah implementasi FastCGI alternatif untuk bahasa PHP. PHP-FPM merupakan interpreter PHP yang terpisah dari aplikasi web server. Setiap request atas script PHP yang masuk ke web server akan diteruskan (forward) ke FastCGI melalui socket atau koneksi TCP/IP. Pada artikel ini kita akan membahas langkah-langkah dalam membangun web server dengan PHP-FPM.
Sebelum mengikuti langkah-langkah dalam membangun web server dengan PHP-FPM dalam artikel ini, anda perlu melakukan instalasi web server Apache terlebih dahulu. Anda dapat mengikuti langkah yang telah saya tuliskan dalam artikel berikut
1. Instalasi PHP-FPM
Langkah pertama adalah dengan melakukan instalasi php-fpm dan modul fastcgi apache dengan perintah:
$ sudo apt update
$ sudo apt install php-fpm libapache2-mod-fastcgi
Aktifkan modul actions, fastcgi, cgid dan alias dengan perintah
$ sudo a2enmod actions fastcgi cgid alias
kemudian tambahkan script pada Gambar 1 ke dalam file VirtualHost server anda, misalnya dalam file /etc/apache2/sites-available/000-default.conf. Bila anda memiliki beberapa VirtualHost maka script pada Gambar 1 perlu anda tambahkan pada semua VirtualHost yang anda gunakan.
Alias /php7-fcgi /usr/lib/cgi-bin/php7-fcgi
FastCgiExternalServer /usr/lib/cgi-bin/php7-fcgi -socket /var/run/php/php7.0-fpm.sock -pass-header Authorization
<FilesMatch \.php$>
SetHandler application/x-httpd-php
Action application/x-httpd-php /php7-fcgi
</FilesMatch>
Restart service Apache untuk mengaktifkan konfigurasi tersebut dengan perintah
$ sudo systemctl restart apache2.service
Untuk mengecek apakah konfigurasi tersebut berhasil, buatlah sebuah file PHP berisi
<?php
phpinfo();
?>
dalam root directory (misalnya /var/www/html/info.php). Kemudian akseslah menggunakan web browser, misalnya dengan mengakses http://<domain server anda>/info.php atau http://<alamat IP server anda>/info.php.
Perhatikan nilai Server API pada Gambar 2. Bila nilainya adalah FPM/FastCGI, maka artinya proses instalasi PHP -FPM telah berhasil.
Konfigurasi VirtualHost pada Gambar 1 menggunakan socket untuk menghubungkan Apache dengan PHP-FPM yang berada dalam satu server yang sama. Bila Apache dengan PHP-FPM berada dalam server yang terpisah maka anda harus menggunakan koneksi TCP/IP, namun cara tersebut tidak dibahas dalam artikel ini.
2. Modifikasi Konfigurasi PHP
Tanpa langkah berikut, sebenarnya instalasi PHP tersebut telah dapat digunakan, namun kadang kita perlu melakukan beberapa modifikasi untuk menyesuaikan dengan kebutuhan program PHP yang nantinya kita buat.
Modifikasi cgi.fix_pathinfo
Modifikasi bagian cgi.fix_pathinfo sangat penting dilakukan demi alasan keamanan. Yang perlu kita lakukan adalah membuka file /etc/php/7.0/fpm/php.ini dan mengubah
;cgi.fix_pathinfo=1
menjadi
cgi.fix_pathinfo=0
kemudian me-restart service PHP-FPM dengan perintah
$ sudo systemctl restart php7.0-fpm.service
Modifikasi ini sangat penting dilakukan untuk mencegah PHP mengeksekusi file dengan nama yang paling mirip bila file dengan nama yang sama persis tidak ditemukan.
Instalasi MySQL module
Bila anda ingin menggunakan PHP untuk mengolah RDBMS MySQL atau MariaDB, maka anda perlu mengaktifkan PHP MySQL module dengan cara menjalankan perintah
$ sudo apt install php-mysql
kemudian anda perlu me-restart service PHP-FPM dengan perintah
$ sudo systemctl restart php7.0-fpm.service
Untuk memastikan bahwa modul php-mysql telah aktif, buatlah sebuah file di root directory server, misalnya /var/www/html/mysql.php dengan isi
<?php
$servername = "localhost";
$username = "root";
$password = "secret";
$conn = new mysqli($servername, $username, $password);
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
} else {
echo("Connection success.");
}
$conn->close();
?>
kemudian akses file tersebut menggunakan web browser, misalnya dengan mengakses http://<domain server anda>/mysql.php atau http://<alamat IP server anda>/mysql.php. Jangan lupa, anda perlu mengganti $servername, $username, dan $password pada script untuk disesuaikan dengan konfigurasi server anda. Bila output script tersebut adalah
Connection success.
maka instalasi anda berhasil, namun bila tidak maka berarti ada masalah dengan proses instalasi yang anda lakukan.
Pencarian dan Instalasi Berbagai Modul PHP
Untuk meningkatkan fungsionalitas dari PHP, anda dapat menambahkan beberapa modul tambahan ke dalam PHP. Untuk mencari modul-modul yang tersedia dalam repository, gunakanlah perintah
$ sudo apt-cache search php-
Bila anda ingin pencarian yang lebih spesifik, kombinasikan dengan perintah grep, misalnya anda ingin mencari modul PHP yang berkaitan dengan zip, maka anda dapat menggunakan perintah
$ sudo apt-cache search php- | grep zip
Contoh output dari perintah tersebut adalah
libphp-pclzip - transitional dummy package
php-bz2 - bzip2 module for PHP [default]
php-pclzip - ZIP archive manager class for PHP
php-zip - Zip module for PHP [default]
php-zipstreamer - Stream zip files without i/o overhead
php7.0-bz2 - bzip2 module for PHP
php7.0-zip - Zip module for PHP
Bila anda sudah memutuskan modul apa yang perlu anda install, misalnya php-zip, maka gunakan perintah apt install untuk melakukan instalasi PHP modul tersebut. Berikut adalah contoh perintah untuk melakukan instalasi modul php-zip
$ sudo apt install php-zip
Kemudian restart service PHP-FPM dengan perintah
$ sudo systemctl restart php7.0-fpm.service
Menyembunyikan Versi PHP pada HTTP Header
Bila anda tidak menginginkan versi PHP anda tampil pada HTTP Header, demi alasan keamanan misalnya, maka anda dapat memodifikasi file /etc/php/7.0/fpm/php.ini dan /etc/php/7.0/cli/php.ini. Pastikan variable expose_php pada kedua file tersebut bernilai Off seperti ini.
expose_php = Off
Kemudian restart service PHP-FPM dengan perintah
$ sudo systemctl restart php7.0-fpm.service
Mengganti Default Directory Index
Bila anda memiliki dua file index, misalnya index.html dan index.php, dalam satu directory yang sama, maka yang dieksekusi oleh Apache adalah file index.html. Bila anda ingin mengubah urutan prioritas file index, maka anda dapat mengaturnya melalui file /etc/apache2/mods-available/dir.conf.
Ubahlah urutan index.php pada DirectoryIndex yang semula pada urutan keempat seperti ini
<IfModule mod_dir.c>
DirectoryIndex index.html index.cgi index.pl index.php index.xhtml index.htm
</IfModule>
menjadi urutan pertama seperti ini
<IfModule mod_dir.c>
DirectoryIndex index.php index.html index.cgi index.pl index.xhtml index.htm
</IfModule>
Kemudian restart service Apache dengan perintah
sudo systemctl restart apache2.service
https://medium.com/@dataq/instalasi-apache-dan-php-fpm-pada-ubuntu-16-04-cd8900b5d529
https://medium.com/@dataq/instalasi-apache-dan-php-fpm-pada-ubuntu-16-04-cd8900b5d529
https://medium.com/@dataq/instalasi-apache-dan-php-fpm-pada-ubuntu-16-04-cd8900b5d529
https://medium.com/@dataq/instalasi-web-server-apache-pada-ubuntu-16-04-6d3aa768886d
https://medium.com/@dataq/instalasi-web-server-apache-pada-ubuntu-16-04-6d3aa768886d
https://vishnuswmech.medium.com/setting-up-your-own-high-availability-managed-wordpress-hosting-using-amazon-rds-d215060a13b5
https://vishnuswmech.medium.com/setting-up-your-own-high-availability-managed-wordpress-hosting-using-amazon-rds-d215060a13b5
https://www.php.net/manual/en/security.apache.php
https://www.php.net/manual/en/security.apache.php
https://medium.com/cloud-believers/four-great-apache-systems-for-big-data-and-data-lake-apache-shardingsphere-apache-iceberg-238485129944
https://medium.com/cloud-believers/four-great-apache-systems-for-big-data-and-data-lake-apache-shardingsphere-apache-iceberg-238485129944
https://www.howtoforge.com/tutorial/install-apache-with-php-and-mysql-on-ubuntu-16-04-lamp/
https://www.howtoforge.com/tutorial/install-apache-with-php-and-mysql-on-ubuntu-16-04-lamp/
https://www.howtoforge.com/tutorial/install-apache-with-php-and-mysql-on-ubuntu-16-04-lamp/
https://www.howtoforge.com/tutorial/install-apache-with-php-and-mysql-on-ubuntu-18-04-lamp/
https://www.howtoforge.com/tutorial/install-apache-with-php-and-mysql-on-ubuntu-18-04-lamp/
https://medium.com/@dataq/instalasi-linux-apache-mysql-php-lamp-stack-pada-ubuntu-16-04-b243d3048b35
https://medium.com/@dataq/instalasi-linux-apache-mysql-php-lamp-stack-pada-ubuntu-16-04-b243d3048b35
https://medium.com/@dataq/instalasi-linux-apache-mysql-php-lamp-stack-pada-ubuntu-16-04-b243d3048b35
https://medium.com/@dataq/instalasi-linux-apache-mysql-php-lamp-stack-pada-ubuntu-16-04-b243d3048b35
https://medium.com/tag/web-server
https://medium.com/tag/apache
https://medium.com/tag/docker
https://medium.com/tag/docker
https://medium.com/tag/servers
https://medium.com/tag/servers
https://medium.com/tag/web-development
https://medium.com/tag/web-development
https://medium.com/tag/nginx
https://medium.com/tag/nginx
https://medium.com/tag/nginx
https://medium.com/tag/nodejs
https://medium.com/tag/nodejs
https://medium.com/tag/nodejs
https://medium.com/tag/servers
https://medium.com/tag/servers
https://medium.com/tag/servers
https://medium.com/@maneesha.wijesinghe1?source=---------2-----------------------
https://medium.com/@maneesha.wijesinghe1?source=---------2-----------------------
https://medium.com/pcmag-access?source=---------3-----------------------
https://medium.com/pcmag-access?source=---------3-----------------------
https://medium.com/geekculture/designing-a-websocket-server-in-golang-reformers-golang-implementation-strategy-bcd2dc9e368e
https://medium.com/geekculture/designing-a-websocket-server-in-golang-reformers-golang-implementation-strategy-bcd2dc9e368e
https://medium.com/geekculture/designing-a-websocket-server-in-golang-reformers-golang-implementation-strategy-bcd2dc9e368e
https://towardsdatascience.com/python-webserver-with-flask-and-raspberry-pi-398423cc6f5d
https://towardsdatascience.com/python-webserver-with-flask-and-raspberry-pi-398423cc6f5d
https://itnext.io/immutable-infrastructure-using-packer-ansible-and-terraform-7ca6f79582b8
https://itnext.io/immutable-infrastructure-using-packer-ansible-and-terraform-7ca6f79582b8
https://www.cloudbooklet.com/how-to-install-lamp-apache-mysql-php-in-ubuntu-20-04/
https://www.cloudbooklet.com/how-to-install-lamp-apache-mysql-php-in-ubuntu-20-04/
https://www.tecmint.com/install-apache-mariadb-php-phpmyadmin-in-ubuntu-14-10/
https://www.tecmint.com/install-apache-mariadb-php-phpmyadmin-in-ubuntu-14-10/
https://sekolahlinux.com/category/linux/ubuntu/
https://sekolahlinux.com/category/linux/ubuntu/
https://sekolahlinux.com/merubah-apache-server-name-dengan-mod_security-pada-ubuntu-dan-centos/
https://sekolahlinux.com/merubah-apache-server-name-dengan-mod_security-pada-ubuntu-dan-centos/
https://www.liquidweb.com/kb/how-to-install-and-configure-phpmyadmin-on-centos-7/
https://www.liquidweb.com/kb/how-to-install-and-configure-phpmyadmin-on-centos-7/
https://www.liquidweb.com/kb/how-to-install-and-configure-phpmyadmin-on-centos-7/
https://www.tecmint.com/install-lamp-in-centos-7/
https://www.tecmint.com/install-lamp-in-centos-7/
https://www.tecmint.com/install-lamp-in-centos-7/
https://www.tecmint.com/install-phpmyadmin-rhel-centos-fedora-linux/
https://www.tecmint.com/install-phpmyadmin-rhel-centos-fedora-linux/
https://www.digitalocean.com/community/tutorials/how-to-install-linux-apache-mysql-php-lamp-stack-on-centos-7
https://www.digitalocean.com/community/tutorials/how-to-install-linux-apache-mysql-php-lamp-stack-on-centos-7
https://tecadmin.net/install-phpmyadmin-on-centos/
https://tecadmin.net/install-phpmyadmin-on-centos/
https://www.rosehosting.com/blog/how-to-install-phpmyadmin-on-centos-7/
https://www.rosehosting.com/blog/how-to-install-phpmyadmin-on-centos-7/
https://www.rosehosting.com/blog/how-to-install-phpmyadmin-on-centos-7/
http://httpd.apache.org/docs/current/mod/mod_rewrite.html
http://httpd.apache.org/docs/current/mod/mod_rewrite.html
http://httpd.apache.org/docs/current/mod/mod_rewrite.html
https://docs.joomla.org/How_do_UNIX_file_permissions_work%3F
https://docs.joomla.org/How_do_UNIX_file_permissions_work%3F
https://docs.joomla.org/How_do_UNIX_file_permissions_work%3F
https://www.labanapost.com/2008/09/linux/pengalaman-upgrade-hardisk-laptop-di-linux/
https://www.labanapost.com/2010/05/linux/gunakan-partisi-terbesar-di-server-amazon-ec2/
https://www.labanapost.com/2008/09/linux/pentingnya-membagi-partisi-di-linux/
https://www.labanapost.com/2007/05/linux/mengetahui-informasi-hardisk-atau-usb-flashdisk-di-linux/
https://www.digitalocean.com/community/tutorials/how-to-install-wordpress-with-lamp-on-ubuntu-18-04
https://www.digitalocean.com/community/tutorials/how-to-install-wordpress-with-lamp-on-ubuntu-18-04
https://www.dewaweb.com/blog/cara-instal-node-js-dan-deploy-app-di-centos-8/
https://www.dewaweb.com/blog/cara-instal-node-js-dan-deploy-app-di-centos-8/
https://www.dewaweb.com/blog/cara-melakukan-speedtest-server-di-centos-7/
https://www.dewaweb.com/blog/cara-melakukan-speedtest-server-di-centos-7/
https://www.dewaweb.com/blog/cara-instalasi-go-atau-golang-di-centos-7/
https://www.dewaweb.com/blog/cara-instalasi-go-atau-golang-di-centos-7/
https://www.dewaweb.com/blog/tag/lamp-stack/ubuntu/
https://www.dewaweb.com/blog/tag/lamp-stack/ubuntu/
https://www.dewaweb.com/blog/cara-install-mikrotik-chr-pada-server-dengan-centos-8/
https://www.dewaweb.com/blog/cara-install-mikrotik-chr-pada-server-dengan-centos-8/
https://www.dewaweb.com/blog/tag/centos/
https://www.dewaweb.com/blog/tag/centos/
https://www.dewaweb.com/blog/cara-install-mikrotik-chr-pada-server-dengan-centos-8/
https://www.dewaweb.com/blog/cara-install-mikrotik-chr-pada-server-dengan-centos-8/
https://www.dewaweb.com/blog/cara-install-mikrotik-chr-pada-server-dengan-centos-8/
https://www.tecmint.com/change-a-users-default-shell-in-linux/
https://www.tecmint.com/change-a-users-default-shell-in-linux/
https://www.tecmint.com/screen-command-examples-to-manage-linux-terminals/
https://www.tecmint.com/screen-command-examples-to-manage-linux-terminals/
https://www.tecmint.com/screen-command-examples-to-manage-linux-terminals/
https://www.vultr.com/
https://tempel.in/trends
https://tempel.in/trends
https://tempel.in/trends
https://semawur.com/6ighyqUMduuQ
https://tempel.in/view/6737f5c1
https://tempel.in/view/d47c3e91
https://tempel.in/view/4feac358
https://tempel.in/view/c8769226
Dibawah ini kumpulan Artikel Blog sesuai dengan niche nya. Jangan lupa share ke yang lain.
6450 Artikel Seo Tentang Kesehatan
http://bit.ly/6450kesehatan
11850 Artikel Seo Tentang Pendidikan
http://bit.ly/11850Pendidikan
20000 Artikel Seo Tentang lirik lagi
http://bit.ly/20000Lirik
https://www.gnome-look.org/browse/ord/rating
https://pkgs.org/download/net-tools
https://media.neliti.com/media/publications/174408-ID-remastering-distro-ubuntu-untuk-menunjan.pdf
https://www.cacti.net/downloads
http://www.sugengsiswanto.com/2015/01/install-remastersys-untuk-remastering-ubuntu-linux.html
https://docplayer.info/185764-Cara-cepat-mudah-remastering-ubuntu-menggunakan-remastersys-source-situs-resmi-how-to-remastersys.html
https://docplayer.info/185764-Cara-cepat-mudah-remastering-ubuntu-menggunakan-remastersys-source-situs-resmi-how-to-remastersys.html
https://id.wikipedia.org/wiki/Daftar_rilis_Ubuntu
https://darmakusumandaru.blogspot.com/2016/06/tutorial-remastering-linux-ubuntu-1404.html
https://langittutorial.blogspot.com/2017/12/cara-install-dan-menggunakan-respin-remastering-tool-ubuntu-16.html
https://www.gnome-look.org/p/1365372
https://docplayer.info/56989336-Remaster-distro-linux-ubuntu-lts-menggunakan-remastersys-tugas-akhir.html
https://tutorialkreasikotakpensildarikardus.blogspot.com/2019/11/koleksi-tutorial-remastering-ubuntu.html
http://blog.ub.ac.id/izuaf/2012/01/10/remastering-menggunakan-uck-ubuntu-customization-kit
https://issuu.com/arifinlperz/docs/buku_remaster_ubuntu
https://issuu.com/arifinlperz/docs/buku_remaster_ubuntu
https://www.indonesianbacktrack.or.id/forum/thread-5582.html
https://www.proweb.co.id/articles/virtualbox/networking-mode.html
https://www.pintarkomputer.com/virtualbox-cara-mudah-koneksikan-komputer-host-pc-asli-dengan-komputer-guest-virtua
https://www.ayies.com/membuat-virtualbox-2-ethernet-dengan-ip-public-internet-dan-ip-private-lokal-akses-dari-host
------------------------
https://docs.joomla.org/Configuring_a_LAMPP_server_for_PHP_development/Linux_desktop
sudo apt-get install apache2 php5-mysql libapache2-mod-php5 mysql-server phpmyadmin php5-curl
cek localhost after install
echo "<?php phpinfo(); ?>" | sudo tee /var/www/html/test.php
Apache Default Web Site Folder
Location: "/var/www/"
Apache Web Sites Configuration Files
Location: /etc/apache2/sites-available/
Apache Configuration Files
Location: "/etc/apache2/apache2.conf" Location: "/etc/apache2/envvars"
Apache Ports Configuration File
Location: "/etc/apache2/ports.conf"
Apache Log Files
Location: "/var/log/apache2/"
Configuration
Enabling mod_rewrite
The mod_rewrite module uses a rule-based rewriting engine based on a PCRE regular-expression parser to rewrite requested URLs on the fly. By default, mod_rewrite maps a URL to a filesystem path. However, it can also be used to redirect one URL to another URL, or to invoke an internal proxy fetch.
For more information, visit http://httpd.apache.org/docs/current/mod/mod_rewrite.html
sudo a2enmod rewrite
sudo service apache2 restart
Deploying a New Site Folder Structure
By default the Web server is hosting the files in the location "/var/www", but for security reasons
and to avoid ownership problems, we are going to use another place to host our Website files.
Let's create a new folder to store the Web files and the log files of the site.
mkdir /home/youruser/lamp/
mkdir /home/youruser/lamp/public_html/
mkdir /home/youruser/lamp/logs/
NOTE: You can place your new site folders at any location; this is just an example. Replace "youruser" with an actual Linux username.
To store the Website files we are going to use the folder "public_html". For our log files, we are going to use the folder "logs".
sudo cp /etc/apache2/sites-available/000-default.conf /etc/apache2/sites-available/mydevsite.conf
NOTE: "mydevsite" is the name of the new site used in this example. You can use any other name you like.
sudo gedit /etc/apache2/sites-available/mydevsite.conf
<VirtualHost *:80>
# The ServerName directive sets the request scheme, hostname and port that
# the server uses to identify itself. This is used when creating
# redirection URLs. In the context of virtual hosts, the ServerName
# specifies what hostname must appear in the request's Host: header to
# match this virtual host. For the default virtual host (this file) this
# value is not decisive as it is used as a last resort host regardless.
# However, you must set it for any further virtual host explicitly.
#ServerName www.example.com
ServerAdmin webmaster@localhost
DocumentRoot /var/www/html
# Available loglevels: trace8, ..., trace1, debug, info, notice, warn,
# error, crit, alert, emerg.
# It is also possible to configure the loglevel for particular
# modules, e.g.
#LogLevel info ssl:warn
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
# For most configuration files from conf-available/, which are
# enabled or disabled at a global level, it is possible to
# include a line for only one particular virtual host. For example the
# following line enables the CGI configuration for this host only
# after it has been globally disabled with "a2disconf".
#Include conf-available/serve-cgi-bin.conf
</VirtualHost>
# vim: syntax=apache ts=4 sw=4 sts=4 sr noet
Make some modifications to make it look like this, or simply copy and paste it:
<VirtualHost *:80>
ServerAdmin webmaster@localhost
DocumentRoot /home/youruser/lamp/public_html
<Directory />
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
Allow from all
Require all granted
</Directory>
ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
<Directory "/usr/lib/cgi-bin">
AllowOverride All
Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
Order allow,deny
Allow from all
</Directory>
ErrorLog /home/youruser/lamp/logs/error.log
# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
LogLevel warn
CustomLog /home/youruser/lamp/logs/access.log combined
Alias /doc/ "/usr/share/doc/"
<Directory "/usr/share/doc/">
Options Indexes MultiViews FollowSymLinks
AllowOverride All
Order deny,allow
Deny from all
Allow from 127.0.0.0/255.0.0.0 ::1/128
</Directory>
</VirtualHost>
NOTE: Replace "youruser" with your current user name.
Save your changes.
Now we need to enable the site. In a terminal type:
sudo a2ensite mydevsite
Lets disable the default site, since we don't need it anymore.
sudo a2dissite 000-default
Restart Apache to complete the process. In a terminal type:
sudo service apache2 restart
To test out our new site, let's create a quick test file. In a terminal type:
echo "<?php echo 'Hello world, today is is: '.date('Y/m/d'); ?>" | tee /home/youruser/lamp/public_html/today.php
NOTE: Replace "yourname" with your current user name.
Open your browser and navigate to "localhost/today.php".
If everything is working okay, you should see something like this:
Hello world, today is is: 2012/05/05
Enabling Additional Ports
Note: If you have no plans to show your local site to another person over the Internet, skip this section.
With the last configuration you should be able to access your page and access it from another computer connected to your LAN. If your computer is connected to the Internet and also has an assigned Public IP, you can access your site using that IP from any Web browser. Note that some ISPs do not allow HTTP traffic (HTTP = port 80) over dynamic IP addresses. To solve this, you need to configure Apache to reply to requests from a different port. In this case we are going to use the port number 8080 which is easy to remember.
If you are using a router to connect to the Internet, you have to configure a port forwarding setting on your router to let other people see your local site. Google "how to do port forwarding" on your current router model. If you don't know the difference between a Static IP, Dynamic IP, Private IP and a Public IP, we recommend you to do a Wikipedia reading about these topics.
sudo gedit /etc/apache2/ports.conf
Find the line "listen 80" and insert this line underneath:
Listen 8080
SAVE
sudo gedit /etc/apache2/sites-available/mydevsite
Find this directive "<VirtualHost *:80>" and make the following modification:
<VirtualHost *:80 *:8080>
sudo service apache2 restart
To test your new configuration, try to access your site from another computer over Internet. Just type your IP in the browser's address bar and press enter. If the request fails, try the new alternative port like this: xxx.xxx.xxx.xxx:8080
Preventing Ownership and Permissions Problems
On Linux machines, file permissions are an important thing. Linux uses a mechanism to control what users can do and cannot do about folders, files and even the execution of applications. This mechanism consists of parameters, the ownership and the permissions.
Files and Folders Ownership
Ownership has two parameters: The owner and the group.
The "owner" is the user that owns the file or folder and is represented by a "username". In Linux persons, applications and services use usernames. On most Linux distributions, the Apache service runs under the username "www-data".
The "group" is used to associate users into an logical group. This figure is useful when an administrator needs to grant or deny permissions to several users with one single command and not user by user.
Files and Folders Permissions
The permissions have three parameters that represent file and folder permissions for the owner, the group and others. These number range from 0 to 7, and mean the following:
4 = permission to read
2 = permission to write
1 = permission to execute
0 = no permissions at all
Note: "Others" represents everybody. This parameter is used to grant permission to everyone no matter the user or the group they belong to. This parameter should be set with care under certain situations. Granting incorrect permissions to sensitive files and folders can cause security problems.
For example, if we have a file with permissions such as "644", it means (owner=read+write)(group=read)(others=read).
To get more information about the Linux file systems and file permissions
Adding Yourself to the Apache Group and Modifying Permissions
For this example, your username will be "youruser". On most Linux distributions, the Apache service runs on the user "www-data" and the group "www-data". We need to include our user "youruser" in the "www-data" group to be able to set permissions to the Web server files and have no problems when we have to edit them.
To add "youruser" to the Apache group, open a terminal and type:
sudo adduser youruser www-data
Now we need to change the owner and group of all our Web server files to owner "www-data" and group "www-data".
sudo chown -R www-data:www-data /home/youruser/lamp/public_html
Finally, we have to set the correct folder permission so both Apache and our user can edit the files with no problems. On a terminal type:
sudo chmod -R 775 /home/youruser/lamp/public_html
Common Problems and Confusions
When Joomla creates files on extension installations or any other operation, it uses the default mask 755 for folders and 644 for files. These permissions are correct and secure for production servers but it will give us problems on our local server because our editor will not be able to edit those files and folders. To fix these problems, simply run again this command:
sudo chmod -R 775 /home/youruser/lamp/public_html
In the case you manually move files from your personal folders to the server Web folder "public_html" those new files most likely will be owned by your username. This can cause problems if the server needs to modify or delete information. To prevent this problem, every time you move or copy information to your server Web folder you have to set the correct owner and group permissions for all those new files. Open a terminal and run this command:
sudo chown -R www-data:www-data /home/youruser/lamp/public_html
Note: If your server has too many files, these commands could be slow but you can always set a more specific path to apply permission in fewer files.
An other option is to configure the default Apache owner and group. For all new files created by the server these settings are used. We can change the in the environment variables file. Run this command to open and edit the file:
sudo gedit /etc/apache2/envvars
Find the following lines and change them this way (replace "youruser" with your current username):
export APACHE_RUN_USER=youruser
export APACHE_RUN_GROUP=www-data
Restart apache with the following command:
sudo service apache2 restart
Other Configurations
Open a terminal and type:
sudo gedit /etc/php5/apache2/php.ini
Find the line:
output_buffering =
Set the value to "= Off".
Find the line:
post_max_size =
Set the value to "= 20M".
Find the line:
upload_max_filesize =
Set the value to "= 20M".
Save the changes.
Type in your terminal:
sudo service apache2 restart
Enforcing Security
Since your computer is now running Web services, these services are listening for requests and will reply to anyone who has the correct IP and port. In other words, other people in your LAN and Internet can access your local site without your permission or they can even try to crack or hack your workstation. To prevent this, you need to install a firewall and "deny" by default any external incoming requests to your computer.
For Linux users, there is a nice and simple firewall called "Uncomplicated Firewall". To install the user interface and manage the firewall from your desktop, just follow these steps:
Open a terminal and type:
sudo apt-get install gufw
Note: You can also install the application from the Software Manager.
Open the application. When the installation finishes, press the "unlock" button and type your administrative password.
Set "Status = On" and "Incoming = Deny". Leave the rest of the settings at their default values.
To test your firewall, just try to connect to your local site from a local computer on your LAN or a remote computer over the Internet. When the firewall status is "Status = On", you shouldn't be able to connect at all.
Now temporarily change the status of your firewall to "Status = Off" and try to connect again. People should be able to see your local site just fine. Remember to set "Status = On" after this test.
Note: In this tutorial we are denying any incoming external requests to any port. As a side note, you can also Deny all incoming requests and manually allow incoming requests to few specific ports if you wish, but those kinds of settings are up to you. Since a PC workstation is not a server, it is okay to deny all incoming traffic by default.
https://jagowebdev.com/install-xampp-lebih-dari-satu-di-satu-komputer/
https://jagowebdev.com/install-xampp-lebih-dari-satu-di-satu-komputer/
---------------------------
CENTOS .......
https://www.dewaweb.com/blog/cara-install-lamp-stack-di-centos-7/
Sebelum memulainya, perlu instalasi Firewall supaya lebih secure.
Pada Firewall ini menggunakan CSF (ConfigServer Security & Firewall).
Sekilas Tentang CSF
CSF adalah Stateful Packet Ispection Firewall, Login dan Intrusion Detection & Security Application
untuk Linux Server.
cd /usr/src
wget https://download.configserver.com/csf.tgz
tar -xzf csf.tgz
cd csf
sh install.sh
nano /etc/csf/csf.conf
csf -r *RESTART ...
Berikut ini cara install LAMP Stack di CentOS 7:
Step 1 – Add Repository
Login sebagai root dan add repository EPEL dengan command di bawah ini:
rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY*
yum install epel-release -y
yum install mariadb-server mariadb -y
systemctl start mariadb.service
systemctl enable mariadb.service
mysql_secure_installation
Enter current password for root (enter for none): <= [ENTER]
OK, successfully used password, moving on...
Set root password? [Y/n] y
New password: <= [Masukan Password root MySQL]
Re-enter new password: <= [Masukan Password root MySQL]
Password updated successfully!
Reloading privilege tables..
... Success!
Remove anonymous users? [Y/n] y
... Success!
Disallow root login remotely? [Y/n] y
... Succes!
Remove test database and access to it? [Y/n] y
- Dropping test database...
... Success!
- Removing privileges on test database...
... Success!
Reload privilege tables now? [Y/n] y
... Success!
All done! If you've completed all of the above steps, your MariaDB
installation should now be secure.
Install web server Apache sesuai dengan LAMP Stack. Untuk saat ini Apache versi terbaru adalah 2.4.
Start dan enable Apache untuk start on-boot.
yum install httpd -y
systemctl start httpd
systemctl enable httpd
Lakukan instalasi PHP untuk memproses script website untuk ditampilkan menjadi sebuah konten.
Tambahkan Remi CentOS Repository.
rpm -Uvh http://rpms.remirepo.net/enterprise/remi-release-7.rpm
yum install yum-utils -y
yum update -y
yum-config-manager --enable remi-php70
yum install php php-opcache -y
systemctl restart httpd.service ** Restart Apache untuk memperbaharui perubahan.
https://www.dewaweb.com/blog/cara-install-lamp-stack-di-centos-7/
https://www.dewaweb.com/blog/cara-instalasi-lamp-stack-di-centos-8/
Control panel tak selalu perlu digunakan untuk mengelola website pribadi di VPS atau cloud server, hal ini dapat dilakukan jika kamu sudah memiliki pengalaman pada Linux atau menjadi system administrator, karena nantinya akan penuh dengan CLI (Command Line Interface) tidak ada GUI seperti cPanel atau CWP pada umumnya. Pada artikel ini kami akan membahas mengenai cara instalasi LAMP Stack di CentOS 8.
DNF atau Dandified YUM merupakan generasi terbaru dari package manager untuk distribusi berbasis .rpm yang dirilis pada 2018. Pada command atau perintah di CentOS 8 ini, kita akan lebih banyak menggunakan DNF.
Sebelum mulai mempraktikkan cara instalasi LEMP Stack, pastikan kamu sudah memenuhi beberapa persyaratan berikut:
VPS dengan OS CentOS 8.
Domain yang sudah diarahkan ke alamat IP VPS. (Dewaweb juga menyediakan hosting murah gratis domain)
Akses root.
Update Packages CentOS 8
Kamu perlu melakukan update package pada CentOS 8 terlebih dulu menggunakan perintah DNF, kemudian reboot server.
dnf update
reboot
dnf install httpd httpd-tools -y
systemctl enable httpd
systemctl start httpd
systemctl status httpd
Setelah instalasi web server, untuk mendapatkan versi terbaru dari Apache,
kamu bisa menggunakan command di bawah ini:
rpm -qi httpd
Name : httpd
Version : 2.4.37
Release : 16.module_el8.1.0+256+ae790463
Architecture: x86_64
Install Date: Thu 21 May 2020 06:44:49 AM UTC
Group : System Environment/Daemons
Size : 5611291
License : ASL 2.0
Signature : RSA/SHA256, Mon 23 Dec 2019 10:22:02 PM UTC, Key ID 05b555b38483c65d
Source RPM : httpd-2.4.37-16.module_el8.1.0+256+ae790463.src.rpm
Build Date : Mon 23 Dec 2019 08:46:30 PM UTC
Build Host : x86-02.mbox.centos.org
Relocations : (not relocatable)
Packager : CentOS Buildsys <[email protected]>
Vendor : CentOS
URL : https://httpd.apache.org/
Summary : Apache HTTP Server
Description :
The Apache HTTP Server is a powerful, efficient, and extensible
web server.
Di sini kami menggunakan MariaDB sebagai Database di LAMP Stack ini, karena MySQL saat ini sudah deprecated alias tidak up-to-date.
dnf install mariadb-server mariadb -y
systemctl start mariadb
systemctl enable mariadb
systemctl status mariadb
Kemudian, ketikan perintah atau command di bawah ini untuk mulai inisialisasi MariaDB.
mysql_secure_installation
Enter current password for root (enter for none):
OK, successfully used password, moving on…
Set root password? [Y/n] y
New password:
Re-enter new password:
Password updated successfully!
Reloading privilege tables..
… Success!
Remove anonymous users? [Y/n] y
… Success!
Disallow root login remotely? [Y/n] y
… Success!
Remove test database and access to it? [Y/n] y
– Dropping test database…
… Success!
– Removing privileges on test database…
… Success!
Reload privilege tables now? [Y/n] y
… Success!
Cleaning up…
All done! If you’ve completed all of the above steps, your MariaDB
installation should now be secure.
sudo dnf install https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm
Install EPEL Repository
dnf install https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm
Install YUM-Utils
dnf install dnf-utils http://rpms.remirepo.net/enterprise/remi-release-8.rpm
Gunakan command di bawah ini untuk melihat PHP module yang tersedia untuk diinstal.
dnf module list php
Remi’s Modular repository for Enterprise Linux 218 kB/s | 567 kB 00:02
Safe Remi’s RPM repository for Enterprise Linux 400 kB/s | 1.5 MB 00:03
Last metadata expiration check: 0:00:01 ago on Thu 21 May 2020 06:52:37 AM UTC.
CentOS-8 – AppStream
Name Stream Profiles Summary
php 7.2 [d] common [d], devel, minimal PHP scripting language
php 7.3 common, devel, minimal PHP scripting language
Remi’s Modular repository for Enterprise Linux 8 – x86_64
Name Stream Profiles Summary
php remi-7.2 common [d], devel, minimal PHP scripting language
php remi-7.3 common [d], devel, minimal PHP scripting language
php remi-7.4 common [d], devel, minimal PHP scripting language
Hint: [d]efault, [e]nabled, [x]disabled, [i]nstalled
Dari output di atas, PHP versi 7.4 adalah versi terbaru yang akan digunakan sebagai bagian
rangkaian cara instalasi LAMP Stack berikut, tapi kamu perlu melakukan reset PHP module
terlebih dulu dengan memasukkan command di bawah ini.
dnf module reset php
Kemudian enable module php versi 7.4 yang terbaru atau up-to-date.
$ dnf module enable php:remi-7.4
Dependencies resolved.
dnf install php php-opcache php-gd php-curl php-mysqlnd
php -v
systemctl enable php-fpm
systemctl start php-fpm
systemctl status php-fpm
Pada SELinux, untuk mengizinkan Apache untuk mengeksekusi php via php-fpm, perlu seperti di bawah ini.
setsebool -P httpd_execmem 1
systemctl restart httpd
https://www.labanapost.com/2008/11/linux/instalasi-lampp-cara-saya/
http://www.labanapost.com/2008/09/linux/bagi-bagi-partisi-di-linux/
http://www.labanapost.com/2008/09/linux/bagi-bagi-partisi-di-linux/
====================
https://www.niagahoster.co.id/blog/cara-install-wordpress/
mysql -uroot -p
Create Database:
CREATE DATABASE wordpresslamp CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci;
Create User Database dan Grant Permissionsnya.
GRANT ALL ON wordpresslamp.* TO 'dewauser'@'localhost' IDENTIFIED BY 'dewawebwp123';
Flush Privileges untuk reload perubahan dan keluar dari MySQL.
FLUSH PRIVILEGES;
EXIT;
cd /tmp
wget https://wordpress.org/latest.tar.gz
tar -xzf latest.tar.gz
cp /tmp/wordpress/wp-config-sample.php /tmp/wordpress/wp-config.php
cd /var/www/html/
mkdir lamp.dewiweb.net
chown -R apache:apache /var/www/html/lamp.dewiweb.net/
sudo cp -a /tmp/wordpress/. /var/www/html/lamp.dewiweb.net/
Generate secret salt secret key WordPress.
curl -s https://api.wordpress.org/secret-key/1.1/salt/
Key yang digenerate akan seperti dibawah ini.
define('AUTH_KEY','>i{2HZWW%#@[ejU_:@IQ,j*]B!~Hf`(gw7Mfk_+%@HoV8oo@=]+8X{8*dh>VTFB]');
define('SECURE_AUTH_KEY', '_uVe4X.-%c)ob^cWDxItqwa,J*,z]N4{N5!WOOMXl>JUqn|!JyOw7?&?2SQZM|3+');
define('LOGGED_IN_KEY', 'P~kb+.lQS./gA-L.E8+a>YZKN{zQ|*$8CKzwZ;bB~>gYuP5l Aa;OWrZ<N)iX<nW');
define('NONCE_KEY', '5Pl4 %AdlqowfwE;|m!z?S~ 6^8L7+vY]M=hb3a7^C>?2C`fz+u|H[F!Jf!b/uAE');
define('AUTH_SALT', 'IiI<>I<Lu)K6FaaB@OVd+a:Ao@`tbR1Hhb}a,M+4A0BG}hH$I.Qyd{x~BP4?ww( ');
define('SECURE_AUTH_SALT', 'c%G+Z|_{9i6|x4:6#up}S}SCIW;I2:c^-dtM<<DwZ`kE4)X=!XSRIid&`3cj4DCy');
define('LOGGED_IN_SALT', 'W>XGF~*uk[mA<VgO6+{FI,W,oCzp(K`r3-#3Q#0I*A1gHUoM-D|>7P4>]R+..~^K');
define('NONCE_SALT', '8NRqc!14jFBWw`:q}?NwM0h_r}@`7z^HM!A%j_VvlhcwOJ-J`#YIaBV6@9mO%| I');
/** The name of the database for WordPress */
define( 'DB_NAME', 'wordpresslamp' );
/** MySQL database username */
define( 'DB_USER', 'dewauser' );
/** MySQL database password */
define( 'DB_PASSWORD', 'dewawebwp123' );
/** MySQL hostname */
define( 'DB_HOST', 'localhost' );
Save dan exit.
yum install git -y
cd /opt
git clone https://github.com/letsencrypt/letsencrypt
service httpd stop
./letsencrypt/letsencrypt-auto certonly --standalone
Ikuti intruksi seperti di bawah ini.
Enter email address (used for urgent renewal and security notices) (Enter 'c' to
cancel): [email protected]
Please enter in your domain name(s) (comma and/or space separated) (Enter 'c'
to cancel): lamp.dewiweb.net
Certificate dan Chainnya disimpan pada:
/etc/letsencrypt/live/lamp.dewiweb.net/fullchain.pem
Private Key disimpan pada:
/etc/letsencrypt/live/lamp.dewiweb.net/privkey.pem
nano /etc/httpd/conf.d/example.com.conf
<VirtualHost *:80>
ServerName lamp.dewiweb.net
ServerAlias www.lamp.dewiweb.net
Redirect permanent / https://lamp.dewiweb.net/
</VirtualHost>
<VirtualHost *:443>
ServerName lamp.dewiweb.net
ServerAlias www.lamp.dewiweb.net
<If "%{HTTP_HOST} == 'www.lamp.dewiweb.net'">
Redirect permanent / https://lamp.dewiweb.net/
</If>
DirectoryIndex index.html index.php
DocumentRoot /var/www/html/lamp.dewiweb.net
ErrorLog /var/log/httpd/lamp.dewiweb.net-error.log
CustomLog /var/log/httpd/lamp.dewiweb.net-access.log combined
SSLEngine On
SSLCertificateFile /etc/letsencrypt/live/lamp.dewiweb.net/fullchain.pem
SSLCertificateKeyFile /etc/letsencrypt/live/lamp.dewiweb.net/privkey.pem
<Directory /var/www/html/lamp.dewiweb.net>
Options FollowSymLinks
AllowOverride All
Require all granted
</Directory>
</VirtualHost>
*save
systemctl start httpd
$ yum install php-fpm php-mysql php-mysqlnd php-pdo php-gd php-ldap php-odbc php-pear php-xml php-xmlrpc php-mbstring php-soap curl curl-devel -y
systemctl restart httpd
https://www.dewaweb.com/blog/cara-install-wordpress-dengan-lamp-stack/
https://www.dewaweb.com/blog/cara-install-lamp-stack-di-centos-7/
https://betterprogramming.pub/
https://www.dewaweb.com/blog/cara-mencegah-dan-mengatasi-serangan-di-wordpress/
https://www.hostinger.co.id/tutorial/install-lamp-ubuntu-16-04
adduser<username>
Kemudian buat sudoer untuk user yang baru saja dibuat.
usermod -aG sudo <username>
sudo su - <username>
sudo apt-get update
sudo apt-get upgrade
sudo apt-get install apache2
http://<your_vps_ip_address_here>
http://195.110.59.211
sudo apt-get install ufw
sudo ufw allow http
sudo ufw allow https
sudo systemctl status apache2
sudo apt-get install mysql-server
sudo systemct1 status mysql
sudo apt-get install php libapache2-mod-php php-mcrypt php-mysql php-cgi php-curl php-json
sudo apt-get install nano
sudo nano /var/www/html/test.php
Pada saat instalasi berlangsung, Anda akan diminta untuk memasukkan password user root.
Pastikan untuk memasukkan password yang kut. Anda harus mengisi kolom password.
Perintah di atas mengizinkan traffic HTTP dan HTTPS melewati firewall. UFW merupakan aplikasi baris perintah
yang disebut Uncomplicated Firewall. UFW digunakan untuk mengelola dan membuat rule untuk Linux firewall.
Masukkan alamat IP VPS Anda ke browser untuk mengecek instalasi. Anda dapat mengecek status server Apache
dengan perintah di bawah ini.
Catatan: Jika Anda tidak tahu alamat IP VPS Anda, maka cara tercepat untuk mengetahuinya adalah
dengan menjalankan perintah di bawah ini. Perintah ini akan menampilkan alamat IP publik dari VPS Anda.
dig +short myip.opendns.com @resolver1.opendns.com
https://www.niagahoster.co.id/blog/cara-install-lamp-ubuntu/
Akses server menggunakan SSH dengan menggunakan user root, kemudian tambahkan user baru pada server tersebut.
$ adduser<username>
Perintah ini digunakan untuk menambahkan user baru. Agar mempunyai akses super user, maka user yang baru saja dibuat ditambahkan pada sudoers. Sudoers merupakan daftar yang digunakan untuk mencatat user apa saja yang mempunyai akses sampai ke root.
$ usermod -aG sudo <username>
Setelah proses penambahan user baru selesai maka terbentuk user baru di server, putuskan
koneksi SSH kemudian lakukan akses SSH kembali dengan user yang telah dibuat. Atau, jika
tidak ingin memutuskan koneksi dapat langsung masuk ke user baru. Caranya dengan
mengetikkan sudo su <username> pada teks perintah.
sudo apt-get update
sudo apt-get install apache2
http://<your_vps_ip_address_here>
http://10.11.12.13
sudo apt-get install ufw
sudo ufw allow http
sudo ufw allow https
sudo systemctl status apache2
sudo apt-get install mysql-server
sudo systemctl status mysql
sudo apt-get install php libapache2-mod-php php-mcrypt php-mysql php-cgi php-curl php-json
cd /var/www/html/
https://upcloud.com/community/tutorials/installing-lamp-stack-ubuntu/
sudo apt update
sudo apt upgrade
Now open ports 22 (for SSH), 80 and 443 and enable Ubuntu Firewall (ufw):
sudo ufw allow ssh
sudo ufw allow 80
sudo ufw allow 443
sudo ufw enable
sudo apt install apache2
sudo systemctl status apache2
http://YOURSERVERIPADDRESS/
sudo apt install php7.4 php7.4-mysql php-common php7.4-cli php7.4-json php7.4-common php7.4-opcache libapache2-mod-php7.4
php --version
sudo systemctl restart apache2
echo '<?php phpinfo(); ?>' | sudo tee -a /var/www/html/phpinfo.php > /dev/null
http://YOURSERVERIPADDRESS/phpinfo.php
sudo rm /var/www/html/phpinfo.php
sudo apt install mariadb-server mariadb-client
sudo systemctl status mariadb
sudo mysql_secure_installation *manual inputan .... Y
As you have no root password set for MariaDB you should simply press Enter when prompted, pressing Y on the next question to then set a root password (keep this safe and secure!) With that set, you can press Enter for the remaining questions as the defaults for each of these will help to secure your new installation.
https://betterprogramming.pub/how-to-install-lamp-stack-on-ubuntu-db77ac018116
sudo apt-get update
sudo apt-get install mysql-server mysql-client libmysqlclient-dev
sudo apt-get install apache2 apache2-doc apache2-npm-prefork apache2-utils libexpat1 ssl-cert
sudo apt-get install libapache2-mod-php7.0 php7.0 php7.0-common php7.0-curl php7.0-dev php7.0-gd php-pear php-imagick php7.0-mcrypt php7.0-mysql php7.0-ps php7.0-xsl
sudo apt-get install phpmyadmin
https://phoenixnap.com/kb/how-to-install-lamp-stack-on-ubuntu
sudo apt-get update
sudo apt-get install apache2
sudo service apache2 status
sudo ufw app list
sudo ufw app info “Apache Full”
sudo apt-get install curl
curl http://icanhazip.com
sudo apt-get install mysql-server
sudo apt-get install php libapache2-mod-php php-mysql
sudo nano /etc/apache2/mods-enabled/dir.conf *to move index html to index php
sudo systemctl restart apache2
apt-cache search php- | less
apt-cache show php-cli *For example, to find out what the module php-cli does, type:
sudo apt-get install php-cli
sudo nano /var/www/html/info.php
https://www.digitalocean.com/community/tutorials/how-to-install-linux-apache-mysql-php-lamp-stack-ubuntu-18-04
$ sudo a2enmod php7.2
Considering dependency mpm_prefork for php7.2:
Considering conflict mpm_event for mpm_prefork:
Considering conflict mpm_worker for mpm_prefork:
Module mpm_prefork already enabled
Considering conflict php5 for php7.2:
Enabling module php7.2.
To activate the new configuration, you need to run:
systemctl restart apache2
$ sudo systemctl restart apache2
https://sekolahkoding.com/forum/membuat-virtual-host-di-web-server-apache-linux-ubuntukali-linux-dll
mkdir /var/www/html/domainku.bro
cd /etc/apache2/sites-available/
sudo cp 000-default.conf domainku-bro.conf
sudo nano domainku-bro.conf
<VirtualHost *:80>
#ServerName www.example.com
ServerAdmin webmaster@localhost
DocumentRoot /var/www/html
#LogLevel info ssl:warn
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
#Include conf-available/serve-cgi-bin.conf
</VirtualHost>
ubah bagian www.example.com menjadi nama domain yang ingin dibuat misal menjadi domainku.bro, jangan lupa hilangkan tanda # di belakangnya dan bagian /var/www/html menjadi lokasi yang sudah kita buat di step 1 tadi. untuk yang lainnya biarkan default saja, kurang lebih akan jadi seperti ini
<VirtualHost *:80>
ServerName domainku.bro
ServerAdmin webmaster@localhost
DocumentRoot /var/www/html/domainku.bro
#LogLevel info ssl:warn
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
#Include conf-available/serve-cgi-bin.conf
</VirtualHost>
sudo a2ensite domainku.bro
sudo nano /etc/hosts
127.0.0.1 domainku.bro
sudo service apache2 reload
https://www.digitalocean.com/community/tutorials/how-to-install-linux-apache-mariadb-php-lamp-stack-on-debian-10
on DEBIAN 10
sudo apt update
sudo apt install apache2
sudo ufw app list
The WWW profiles are used to manage ports used by web servers:
Output
Available applications:
. . .
WWW
WWW Cache
WWW Full
WWW Secure
sudo ufw app info "WWW Full"
Output
Profile: WWW Full
Title: Web Server (HTTP,HTTPS)
Description: Web Server (HTTP,HTTPS)
Ports:
80,443/tcp
sudo ufw allow in "WWW Full"
http://your_server_ip
sudo apt install mariadb-server
sudo mysql_secure_installation
sudo mariadb
CREATE DATABASE example_database;
GRANT ALL ON example_database.* TO 'example_user'@'localhost' IDENTIFIED BY 'password' WITH GRANT OPTION;
FLUSH PRIVILEGES;
exit
mariadb -u example_user -p
SHOW DATABASES;
sudo apt install php libapache2-mod-php php-mysql
This should install PHP without any problems. We’ll test this in a moment.
sudo nano /etc/apache2/mods-enabled/dir.conf
<IfModule mod_dir.c>
DirectoryIndex index.html index.cgi index.pl index.php index.xhtml index.htm
</IfModule>
Move like ...
<IfModule mod_dir.c>
DirectoryIndex index.php index.html index.cgi index.pl index.xhtml index.htm
</IfModule>
sudo systemctl reload apache2
sudo systemctl status apache2
create vhost
sudo mkdir /var/www/your_domain
sudo chown -R $USER:$USER /var/www/your_domain
sudo nano /etc/apache2/sites-available/your_domain.conf
<VirtualHost *:80>
ServerName your_domain
ServerAlias www.your_domain
ServerAdmin webmaster@localhost
DocumentRoot /var/www/your_domain
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
With this VirtualHost configuration, we’re telling Apache to serve your_domain using /var/www/your_domain
as the web root directory. If you’d like to test Apache without a domain name, you can remove or comment
out the options ServerName and ServerAlias by adding a # character in the beginning of each option’s lines.
You can now use a2ensite to enable this virtual host:
sudo a2ensite your_domain
sudo a2dissite 000-default
sudo apache2ctl configtest
sudo systemctl reload apache2
nano /var/www/your_domain/info.php
http://your_domain/info.php
mariadb -u example_user -p
CREATE TABLE example_database.todo_list (
item_id INT AUTO_INCREMENT,
content VARCHAR(255),
PRIMARY KEY(item_id)
);
INSERT INTO example_database.todo_list (content) VALUES ("My first important item");
SELECT * FROM example_database.todo_list;
nano /var/www/your_domain/todo_list.php
<?php
$user = "example_user";
$password = "password";
$database = "example_database";
$table = "todo_list";
try {
$db = new PDO("mysql:host=localhost;dbname=$database", $user, $password);
echo "<h2>TODO</h2><ol>";
foreach($db->query("SELECT content FROM $table") as $row) {
echo "<li>" . $row['content'] . "</li>";
}
echo "</ol>";
} catch (PDOException $e) {
print "Error!: " . $e->getMessage() . "<br/>";
die();
}
http://your_domain/todo_list.php
https://www.gnome-look.org/browse/ord/rating
https://pkgs.org/download/net-tools
https://media.neliti.com/media/publications/174408-ID-remastering-distro-ubuntu-untuk-menunjan.pdf
https://www.cacti.net/downloads
http://www.sugengsiswanto.com/2015/01/install-remastersys-untuk-remastering-ubuntu-linux.html
https://docplayer.info/185764-Cara-cepat-mudah-remastering-ubuntu-menggunakan-remastersys-source-situs-resmi-how-to-remastersys.html
https://docplayer.info/185764-Cara-cepat-mudah-remastering-ubuntu-menggunakan-remastersys-source-situs-resmi-how-to-remastersys.html
https://id.wikipedia.org/wiki/Daftar_rilis_Ubuntu
https://darmakusumandaru.blogspot.com/2016/06/tutorial-remastering-linux-ubuntu-1404.html
https://langittutorial.blogspot.com/2017/12/cara-install-dan-menggunakan-respin-remastering-tool-ubuntu-16.html
https://www.gnome-look.org/p/1365372
https://docplayer.info/56989336-Remaster-distro-linux-ubuntu-lts-menggunakan-remastersys-tugas-akhir.html
https://tutorialkreasikotakpensildarikardus.blogspot.com/2019/11/koleksi-tutorial-remastering-ubuntu.html
http://blog.ub.ac.id/izuaf/2012/01/10/remastering-menggunakan-uck-ubuntu-customization-kit
https://issuu.com/arifinlperz/docs/buku_remaster_ubuntu
https://issuu.com/arifinlperz/docs/buku_remaster_ubuntu
https://www.indonesianbacktrack.or.id/forum/thread-5582.html
https://www.proweb.co.id/articles/virtualbox/networking-mode.html
https://www.pintarkomputer.com/virtualbox-cara-mudah-koneksikan-komputer-host-pc-asli-dengan-komputer-guest-virtua
https://www.ayies.com/membuat-virtualbox-2-ethernet-dengan-ip-public-internet-dan-ip-private-lokal-akses-dari-host
======================================
Ansibel
sudo apt install apache2
sudo systemctl status apache2
sudo ufw app list
Apache
Apache Full
Apache Secure
OpenSSH
As you can see, Apache and OpenSSH applications have installed UFW profiles.
If you look into the “Apache Full” profile, you will see that it enables traffic to the ports 80 and 443:
sudo ufw app info "Apache Full"
Profile: Apache Full
Title: Web Server (HTTP,HTTPS)
Description: Apache v2 is the next generation of the omnipresent Apache web
server.
Ports:
80,443/tcp
sudo ufw allow in "Apache Full"
sudo apt install mariadb-server mariadb-client
sudo apt-get install software-properties-common
sudo apt-key adv --recv-keys --keyserver hkp://keyserver.ubuntu.com:80 0xF1656F24C74CD1D8
sudo add-apt-repository 'deb [arch=amd64,arm64,ppc64el] http://sgp1.mirrors.digitalocean.com/mariadb/repo/10.3/ubuntu bionic main'
sudo apt update
sudo apt install mariadb-server
sudo systemctl status mysql
mysql_secure_installation
Enter current password for root (enter for none):
ERROR 1698 (28000): Access denied for user 'root'@'localhost'
Enter current password for root (enter for none):
You can't login set the password. You will see an error like below.
To fix this problem, log in as MySQL database administrator using command:
sudo mysql -u root
use mysql;
update user set plugin='' where User='root';
flush privileges;
\q
mysql_secure_installation
Enter current password for root (enter for none): # Press ENTER
OK, successfully used password, moving on...
Setting the root password ensures that nobody can log into the MariaDB
root user without the proper authorisation.
Set root password? [Y/n] # Press ENTER...
New password: # Enter password
Re-enter new password: # Re-enter password...
Password updated successfully!
PHP...
sudo apt install php libapache2-mod-php php-mysql
sudo vi /var/www/html/info.php
sudo systemctl restart apache2
sudo apt-cache search php- | less
sudo apt-cache show php-gd
sudo apt install php-gd
To install all modules (not necessary though), run:
sudo apt-get install php*
https://ostechnix.com/install-apache-mariadb-php-lamp-stack-on-arch-linux-2016/
https://ostechnix.com/install-nginx-mariadb-php-lemp-stack-on-arch-linux-2016/
https://www.tecmint.com/install-apache-mariadb-php-phpmyadmin-in-ubuntu-14-10/
sudo hostnamectl set-hostname yourFQDNname
sudo hostnamectl
sudo apt-get update && sudo apt-get upgrade
sudo apt-get install apache2
http://your_server_IP
sudo apt-get install php5 php5-mysql php5-mcrypt php5-gd libapache2-mod-php5
sudo apt-cache search php5
sudo apt-cache show php5-module_name
sudo apt-get install mariadb-client mariadb-server
sudo mysql_secure_installation
mysql -u root -p
sudo apt-get install phpmyadmin
sudo cp /etc/phpmyadmin/apache.conf /etc/apache2/conf-available/phpmyadmin.conf
sudo a2enconf phpmyadmin
sudo service apache2 restart
http://your_server_IP/phpmyadmin
sudo nano /var/www/html/info.php
In order to be sure that Apache and MariaDB services are started after every system reboot, install sysv-rc-conf package that manages Ubuntu init scripts, then enable both services system-wide by running the following commands.
$ sudo apt-get install sysv-rc-conf
$ sudo sysv-rc-conf apache2 on
$ sudo sysv-rc-conf mysql on
https://www.howtoforge.com/tutorial/install-apache-with-php-and-mysql-on-ubuntu-18-04-lamp/
https://www.howtoforge.com/tutorial/install-apache-with-php-and-mysql-on-ubuntu-18-04-lamp/
In this tutorial, I will use the hostname server1.example.com with the IP address 192.168.1.100.
sudo -s
apt-get -y install mysql-server mysql-client
mysql_secure_installation
apt-get -y install mariadb-server mariadb-client
mysql_secure_installation
Enter current password for root (enter for none): <-- press enter
Set root password? [Y/n] <-- y
New password: <-- Enter the new MariaDB root password here
Re-enter new password: <-- Repeat the password
Remove anonymous users? [Y/n] <-- y
Disallow root login remotely? [Y/n] <-- y
Reload privilege tables now? [Y/n] <-- y
mysql -u root -p
apt-get -y install apache2
apt-get -y install php7.2 libapache2-mod-php7.2
systemctl restart apache2
nano /var/www/html/info.php
<?php
phpinfo();
chown www-data:www-data /var/www/html/info.php
As you see, PHP 7.2 is working, and it's working through the Apache 2.0 Handler, as shown in the Server API line. If you scroll further down, you will see all modules that are already enabled in PHP. MySQL is not listed there which means we don't have MySQL / MariaDB support in PHP yet.
Get MySQL / MariaDB support in PHP
To get MySQL support in PHP, we can install the php7.2-mysql package. It's a good idea to install some other PHP modules as well as you might need them for your applications. You can search for available PHP modules like this:
apt-cache search php7.2
apt-cache search php-
as not all PHP packages have the version number 7.2 in their name.
apt-get -y install php7.2-mysql php7.2-curl php7.2-gd php7.2-intl php-pear php-imagick php7.2-imap php-memcache php7.2-pspell php7.2-recode php7.2-sqlite3 php7.2-tidy php7.2-xmlrpc php7.2-xsl php7.2-mbstring php-gettext
systemctl restart apache2
Install the Opcache + APCu PHP cache to speed up PHP
PHP 7 ships with a built-in opcode cacher for caching and optimizing PHP intermediate code, it has the name 'opcache' and is available in the package php7.0-opcache. It is strongly recommended to have an Opcache installed to speed up your PHP page. Besides opcache, I will install APCu which is a compatibility wrapper for opcache to provide the functions of the APC cache, an often used caching system in PHP 5.x versions and many CMS systems still use it.
apt-get -y install php7.2-opcache php-apcu
Don't worry if it shows that Opcache is already installed.
systemctl restart apache2
Enable the SSL website in apache
SSL/ TLS is a security layer to encrypt the connection between the web browser and your server. Most web browsers start to show sites as insecure today when the connection between the server and the web browser is not encrypted with SSL. In this chapter, I will show you how to secure your website with SSL.
Execute the following commands on your server to enable SSL (https://) support. Run:
a2enmod ssl
a2ensite default-ssl
which enables the SSL module and adds a symlink in the /etc/apache2/sites-enabled folder to the file /etc/apache2/sites-available/default-ssl.conf to include it into the active apache configuration. Then restart apache to enable the new configuration:
systemctl restart apache2
apt-get -y install python3-certbot-apache
nano /etc/apache2/sites-available/000-default.conf
ServerName example.com
certbot --apache -d example.com
Accept the terms and conditions of the Let's Encrypt SSL authority.
Then choose if you want to redirect non-SSL requests to https:// automatically. I'll select yes here to avoid duplicate content problems when the website is available as http:// and https:// version.
The SSL certificate has been issued successfully.
When you access the website now with a browser, you will get redirected automatically to SSL and the green padlock in front of the URL bar in the browser shows that we are using a trusted SSL certificate now.
Let's encrypt Auto Renewal
Let's Encrypt SSL certificates are valid for a short period of 80 days only. Therefore a cronjob to auto-renew the SSL certificates is necessary that runs the certbot --renew command.
This cronjob get setup automatically when you install certbot, the cron file is /etc/cron.d/certbot. So there is nothing more to do here. If you like to know what the cronjob looks like, run the command:
/etc/cron.d/certbot
root@server1:~# cat /etc/cron.d/certbot
# /etc/cron.d/certbot: crontab entries for the certbot package
#
# Upstream recommends attempting renewal twice a day
#
# Eventually, this will be an opportunity to validate certificates
# haven't been revoked, etc. Renewal will only occur if expiration
# is within 30 days.
SHELL=/bin/sh
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
0 */12 * * * root test -x /usr/bin/certbot -a \! -d /run/systemd/system && perl -e 'sleep int(rand(43200))' && certbot -q renew
apt-get -y install phpmyadmin
Web server to configure automatically: <-- Select the option: apache2
Configure database for phpmyadmin with dbconfig-common? <-- Yes
MySQL application password for phpmyadmin: <-- Press enter, apt will create a random password automatically.
mysql -u root
CREATE USER 'admin'@'localhost' IDENTIFIED BY 'howtoforge';
GRANT ALL PRIVILEGES ON *.* TO 'admin'@'localhost' WITH GRANT OPTION;
FLUSH PRIVILEGES;
exit
Afterward, you can access phpMyAdmin under http://192.168.1.100/phpmyadmin/:
Virtual machine image download of this tutorial
This tutorial is available as ready to use virtual machine image in ovf/ova format that is compatible with VMWare and Virtualbox. The virtual machine image uses the following login details:
SSH / Shell Login
Username: administrator
Password: howtoforge
This user has sudo rights.
MySQL Login
Username: root
Password: howtoforge
The IP of the VM is 192.168.1.100, it can be changed in the file /etc/network/interfaces. Please change all the above passwords to secure the virtual machine.
Apache: http://httpd.apache.org/
PHP: http://www.php.net/
MySQL: http://www.mysql.com/
MariaDB: https://mariadb.com/
Ubuntu: http://www.ubuntu.com/
phpMyAdmin: http://www.phpmyadmin.net/
---------------------
https://www.digitalocean.com/community/tutorials/how-to-install-linux-apache-mysql-php-lamp-stack-on-ubuntu-20-04-id
https://www.digitalocean.com/community/tutorials/how-to-install-linux-apache-mysql-php-lamp-stack-on-ubuntu-20-04-id
Menginstal Apache dan Memperbarui Firewall
sudo apt update
sudo apt install apache2
Setelah instalasi selesai, Anda akan perlu menyesuaikan pengaturan firewall Anda untuk memperbolehkan lalu lintas HTTP. UFW memiliki berbagai profil aplikasi berbeda yang dapat Anda manfaatkan untuk menyelesaikannya. Untuk mendapatkan daftar semua profil aplikasi UFW yang tersedia, Anda dapat menjalankan:
sudo ufw app list
Berikut adalah makna dari setiap profil ini:
Apache: Profil ini hanya membuka porta 80 (lalu lintas web normal dan tidak terenkripsi).
Apache Full: Profil ini membuka baik porta 80 (lalu lintas web normal dan tidak terenkripsi) dan
porta 443 (lalu lintas terenkripsi TLS/SSL).
Apache Secure: Profile ini hanya membuka porta 443 (lalu lintas terenkripsi TLS/SSL).
Untuk saat ini, sebaiknya izinkan hanya koneksi pada porta 80, karena ini adalah instalasi Apache yang baru dan Anda belum memiliki sertifikat TLS/SSL yang dikonfigurasi untuk mengizinkan lalu lintas HTTPS di server Anda.
sudo ufw allow in "Apache"
sudo ufw status
http://your_server_ip
Cara Menemukan Alamat IP Publik Server Anda
Jika Anda tidak mengetahui alamat IP publik server Ada, ada sejumlah cara untuk mengetahuinya. Biasanya, ini adalah alamat yang digunakan untuk terhubung ke server Anda melalui SSH.
Ada beberapa cara untuk melakukannya dari baris perintah. Pertama, Anda dapat menggunakan alat iproute2 untuk mengetahui alamat IP dengan mengetik ini:
ip addr show eth0 | grep inet | awk '{ print $2; }' | sed 's/\/.*$//'
Ini akan menampilkan dua atau tiga baris tanggapan. Semua adalah alamat yang benar, tetapi komputer Anda mungkin hanya dapat menggunakan salah satunya, jadi silakan mencoba masing-masing alamat itu.
Cara alternatifnya adalah menggunakan utilitas curl untuk menghubungi pihak luar supaya memberitahukan bagaimana pihak luar melihat server Anda. Hal ini dilakukan dengan menanyakan alamat IP Anda kepada server tertentu:
curl http://icanhazip.com
Terlepas dari cara yang digunakan untuk mengetahui alamat IP Anda, ketik alamat IP pada bilah alamat di peramban web Anda untuk melihat laman Apache asali.
sudo apt install mysql-server
sudo mysql_secure_installation
Anda akan ditanya apakah Anda ingin mengonfigurasi VALIDATE PASSWORD PLUGIN.
Catatan: Mengaktifkan fitur ini merupakan keputusan yang Anda pertimbangkan sendiri. Jika diaktifkan, kata sandi yang tidak cocok dengan kriteria yang ditentukan akan ditolak oleh MySQL dengan suatu kesalahan. Akan lebih aman jika Anda tetap menonaktifkan validasi, tetapi Anda harus selalu menggunakan kata sandi yang kuat dan unik untuk kredensial basis data.
Jawab Y untuk ya, atau jawaban lain untuk melanjutkan tanpa mengaktifkan.
VALIDATE PASSWORD PLUGIN can be used to test passwords
and improve security. It checks the strength of password
and allows the users to set only those passwords which are
secure enough. Would you like to setup VALIDATE PASSWORD plugin?
Press y|Y for Yes, any other key for No:
Jika Anda menjawab “ya”, Anda akan diminta untuk memilih tingkat validasi kata sandi. Harap ingat bahwa jika Anda memasukkan 2 sebagai tingkat terkuat, Anda akan menjumpai kesalahan saat berusaha menentukan kata sandi yang tidak mengandung angka, huruf kapital dan huruf kecil, serta karakter khusus, atau kata sandi yang berdasarkan pada kata-kata kamus umum.
There are three levels of password validation policy:
LOW Length >= 8
MEDIUM Length >= 8, numeric, mixed case, and special characters
STRONG Length >= 8, numeric, mixed case, special characters and dictionary file
Please enter 0 = LOW, 1 = MEDIUM and 2 = STRONG: 1
Terlepas dari pilihan pengaturan VALIDATE PASSWORD PLUGIN, server Anda akan meminta Anda untuk memilih dan mengonfirmasi kata sandi untuk pengguna root MySQL. Ini tidak sama dengan root sistem. Pengguna root basis data adalah pengguna administratif dengan privilese penuh terhadap sistem basis data. Meskipun metode autentikasi asali untuk pengguna root MySQL mengecualikan penggunaan kata sandi, sekalipun kata kata sandi sudah dibuat, Anda tetap harus menentukan kata sandi yang kuat di sini sebagai langkah keamanan tambahan. Kita akan membahas hal ini sebentar lagi.
Jika Anda mengaktifkan validasi kata sandi, Anda akan diperlihatkan kekuatan kata sandi untuk kata sandi root yang baru saja Anda masukkan dan server Anda akan bertanya apakah Anda ingin melanjutkan dengan kata sandi itu. Jika Anda puas dengan kata sandi ini, tekan Y untuk “ya” di prompt:
Estimated strength of the password: 100
Do you wish to continue with the password provided?(Press y|Y for Yes, any other key for No) : y
Untuk pertanyaan lainnya, tekan Y dan tombol ENTER pada setiap pertanyaan. Ini akan menghapus sebagian pengguna anonim dan basis data percobaan, menonaktifkan log masuk root dari jarak jauh, dan memuat aturan-aturan baru ini sehingga MySQL segera menerapkan perubahan yang Anda buat.
Setelah Anda selesai, lakukan percobaan apakah Anda dapat melakukan log masuk ke konsol MySQL dengan mengetik:
sudo mysql
exit
Anda juga akan memerlukan libapache2-mod-php untuk memungkinkan Apache menangani berkas PHP. Paket PHP inti akan secara otomatis terinstal sebagai dependensi.
sudo apt install php libapache2-mod-php php-mysql
php -v
Menciptakan Hos Virtual untuk Situs Web Anda
Ketika menggunakan server web Apache, Anda bisa menciptakan hos virtual (serupa dengan blok server di Nginx) untuk merangkum detail konfigurasi dan menjadi hos dari lebih dari satu domain dari server tunggal. Dalam panduan ini, kita akan menyiapkan domain bernama your_domain, tetapi Anda harus menggantinya dengan nama domain Anda sendiri.
Catatan: Jika Anda menggunakan DigitalOcean sebagai penyedia hos DNS, lihat dokumen produk kami untuk instruksi mendetail tentang cara mempersiapkan nama domain baru dan mengarahkannya ke server Anda.
Apache pada Ubuntu 20.04 memiliki satu blok server yang aktif secara asali, yang dikonfigurasi untuk menyajikan dokumen-dokumen dari direktori /var/www/html. Meskipun ini berfungsi baik untuk situs tunggal, ini bisa menjadi sulit dijalankan jika Anda menjadi hos dari beberapa situs. Alih-alih memodifikasi /var/www/html, kita akan menciptakan suatu struktur direktori dalam /var/www untuk situs your_domain, dengan membiarkan /var/www/html sebagai direktori asali yang akan ditampilkan jika permintaan klien tidak cocok dengan situs lain.
Buat direktori untuk your_domain sebagai berikut:
sudo mkdir /var/www/your_domain
Selanjutnya, tentukan kepemilikan direktori dengan variabel lingkungan $USER, yang akan merujuk pada pengguna sistem Anda saat ini:
sudo chown -R $USER:$USER /var/www/your_domain
Kemudian, buka berkas konfigurasi baru dalam direktori sites-available Apache dengan menggunakan editor baris perintah yang Anda sukai. Di sini, kita akan menggunakan nano:
sudo nano /etc/apache2/sites-available/your_domain.conf
Ini akan menciptakan berkas kosong yang baru. Tempelkan konfigurasi dasar berikut:
/etc/apache2/sites-available/your_domain.conf
<VirtualHost *:80>
ServerName your_domain
ServerAlias www.your_domain
ServerAdmin webmaster@localhost
DocumentRoot /var/www/your_domain
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
Dengan konfigurasi VirtualHost ini, kita menyuruh Apache untuk menyajikan your_domain menggunakan /var/www/your_domain sebagai direktori root web. Jika Anda ingin menguji Apache tanpa nama domain, Anda dapat menghapus atau memberikan komentar pada opsi ServerName dan ServerAlias dengan menambahkan karakter # di depan masing-masing baris opsi.
Anda dapat menggunakan a2ensite untuk mengaktifkan hos virtual yang baru:
sudo a2ensite your_domain
Anda mungkin ingin menonaktifkan situs web asali yang terinstal dengan Apache. Ini diperlukan jika Anda tidak menggunakan nama domain khusus, karena dalam hal ini, konfigurasi asali Apache akan menimpa hos virtual Anda. Untuk menonaktifkan situs web asali Apache, ketikkan:
sudo a2dissite 000-default
Untuk memastikan berkas konfigurasi Anda tidak berisi kesalahan sintaks, jalankan:
sudo apache2ctl configtest
Terakhir, muat ulang Apache agar perubahan ini diterapkan:
sudo systemctl reload apache2
Situs web Anda yang baru kini sudah aktif, tetapi root web /var/www/your_domain masih kosong.
Buat berkas index.html di dalam lokasi itu sehingga kita dapat menguji apakah hos virtual bekerja sesuai harapan:
nano /var/www/your_domain/index.html
Sertakan konten berikut di dalam berkas ini:
<html>
<head>
<title>your_domain website</title>
</head>
<body>
<h1>Hello World!</h1>
<p>This is the landing page of <strong>your_domain</strong>.</p>
</body>
</html>
Anda dapat meninggalkan berkas ini di lokasinya saat ini sebagai laman landas sementara untuk aplikasi Anda sampai Anda menyiapkan berkas index.php untuk menggantinya. Setelah Anda melakukannya, ingat untuk menghapus atau mengganti nama berkas index.html dari root dokumen Anda, karena berkas ini lebih diutamakan daripada berkas index.php secara asali.
Catatan Tentang DirectoryIndex pada Apache
Dengan pengaturan DirectoryIndex asali pada Apache, berkas yang diberi nama index.html akan selalu lebih diutamakan daripada berkas index.php. Ini berguna untuk menyiapkan laman pemeliharaan di aplikasi PHP, dengan menciptakan berkas index.html sementara yang mengandung suatu pesan informatif bagi pengunjung. Karena lebih diutamakan daripada laman index.php, laman ini akan menjadi laman landas untuk aplikasi. Setelah pemeliharaan selesai, index.html diubah namanya atau dihapus dari root dokumen, sehingga mengembalikan laman aplikasi reguler.
sudo nano /etc/apache2/mods-enabled/dir.conf
<IfModule mod_dir.c>
DirectoryIndex index.php index.html index.cgi index.pl index.xhtml index.htm
</IfModule>
sudo systemctl reload apache2
sudo rm /var/www/your_domain/info.php
Menguji Koneksi Basis Data dari PHP (Opsional)
Saat menyusun tulisan ini, pustaka PHP MySQL asli mysqlndtidak mendukung caching_sha2_authentication, metode autentikasi asali untuk MySQL 8. Kita akan perlu menciptakan pengguna baru dengan metode autentikasi mysql_native_password agar dapat terhubung ke basis data MySQL dari PHP.
Kita akan menciptakan basis data bernama example_database dan pengguna bernama example_user, tetapi Anda dapat mengganti nama-nama ini dengan nilai yang berbeda.
Pertama, hubungkan ke konsol MySQL menggunakan akun root:
sudo mysql
CREATE DATABASE example_database;
CREATE USER 'example_user'@'%' IDENTIFIED WITH mysql_native_password BY 'password';
GRANT ALL ON example_database.* TO 'example_user'@'%';
exit
mysql -u example_user -p
CREATE TABLE example_database.todo_list (
item_id INT AUTO_INCREMENT,
content VARCHAR(255),
PRIMARY KEY(item_id)
);
INSERT INTO example_database.todo_list (content) VALUES ("My first important item");
SELECT * FROM example_database.todo_list;
nano /var/www/your_domain/todo_list.php
<?php
$user = "example_user";
$password = "password";
$database = "example_database";
$table = "todo_list";
try {
$db = new PDO("mysql:host=localhost;dbname=$database", $user, $password);
echo "<h2>TODO</h2><ol>";
foreach($db->query("SELECT content FROM $table") as $row) {
echo "<li>" . $row['content'] . "</li>";
}
echo "</ol>";
} catch (PDOException $e) {
print "Error!: " . $e->getMessage() . "<br/>";
die();
}
http://your_domain_or_IP/todo_list.php
https://httpd.apache.org/docs/current/vhosts/
https://www.howtoforge.com/tutorial/ubuntu-lts-minimal-server/
Preliminary Note
In this tutorial, I use the hostname server1.example.com with the IP address 192.168.0.100 and the gateway 192.168.0.1 These settings might differ for you, so you have to replace them where appropriate.
........
https://www.niagahoster.co.id/blog/cara-install-lemp-di-ubuntu/
LEMP adalah singkatan dari Linux, Nginx, MariaDB, dan PHP. Fungsi LEMP adalah untuk membuat server website dan membantu agar aplikasi menjadi dinamis. Fungsinya sama seperti dengan XAMPP yang ada di sistem operasi Windows.
Langkah 1 : Menginstall Nginx dan Memperbarui Firewall
Nginx adalah web server HTTP dan proxy dengan kode open source yang bisa juga berfungsi sebagai proxy IMAP/POP3. Kenapa menggunakan Nginx? Karena Nginx menawarkan penggunaan memori yang kecil dengan konkurensi yang tinggi. Sehingga akan mempercepat Anda dalam menyelesaikan semua proses di server. Berikut ini adalah langkah-langkah cara update CentOS 7 dan install Nginx.
sudo apt-get update && apt-get upgrade
sudo apt-get install nginx
Terkadang, dalam beberapa kasus halaman default Nginx tidak muncul. Ini dapat disebabkan oleh pengaturan firewall yang diterapkan pada server. Untuk menanggulangi hal ini, Anda perlu install UFW guna mengatur Nginx agar menerima permintaan web pada port 80 dan port 443 di firewall. Oleh karena itu, langkah selanjutnya kami akan memberikan panduan instalasi UFW.
Install UFW
Uncomplicated Firewall (UFW) merupakan kumpulan perintah yang digunakan untuk konfigurasi iptables di Ubuntu. UFW sudah tersedia di Ubuntu dan secara default sudah terinstall di dalamnya.
Untuk melakukan instalasi UFW, gunakan perintah berikut.
sudo apt-get install ufw
Setelah itu, berikan izin pada traffic HTTP dan HTTPS agar bisa melewati firewall
sudo ufw allow http
sudo ufw allow https
ufw –help
sudo systemctl restart nginx
sudo systemctl status nginx
sudo apt install mariadb-server
sudo mysql_secure_installation
Keempat, Anda akan diminta untuk membatasi akses root dari localhost saja. Ini untuk memperkecil kemungkinan orang lain menebak kata sandi root Anda. Klik Y untuk membatasi root di localhost.
sudo mariadb
GRANT ALL ON *.* TO 'admin'@'localhost' IDENTIFIED BY 'admin1234' WITH GRANT OPTION;
FLUSH PRIVILEGES;
exit;
mariadb -u admin -p
sudo apt install php-fpm php-mysql
https://www.niagahoster.co.id/blog/cara-install-wordpress-menggunakan-nginx-di-centos-7/
https://www.niagahoster.co.id/blog/cara-install-wordpress-menggunakan-nginx-di-ubuntu/
https://www.niagahoster.co.id/blog/cara-install-lemp-di-debian/
https://langittutorial.blogspot.com/2017/12/cara-install-dan-menggunakan-respin-remastering-tool-ubuntu-16.html
https://storage.googleapis.com/kubernetes-release/release/stable.txt
https://musaamin.web.id/cara-install-dan-setting-xampp-for-linux/
https://musaamin.web.id/cara-install-dan-setting-xampp-for-linux/
https://langittutorial.blogspot.com/2017/12/cara-install-dan-menggunakan-respin-remastering-tool-ubuntu-16.html
https://musaamin.web.id/cara-install-nextcloud-client-ubuntu/
https://musaamin.web.id/cara-install-nextcloud-client-ubuntu/
https://musaamin.web.id/cara-install-mysql55-ubuntu1804/
groupadd mysql
useradd -g mysql mysql
tar xzvf mysql-5.5.62-linux-glibc2.12-x86_64.tar.gz
mv mysql-5.5.62-linux-glibc2.12-x86_64 /usr/local/mysql
cd /usr/local/mysql
chown -R mysql:mysql *
Install paket dependensi libaio1.
apt install libaio1
scripts/mysql_install_db --user=mysql
cp support-files/my-medium.cnf /etc/my.cnf
Copy file konfigurasi service mysql-server.
bin/mysqld_safe --user=mysql &
cp support-files/mysql.server /etc/init.d/mysql.server
bin/mysqladmin -u root password 'rahasia'
ln -s /usr/local/mysql/bin/mysql /usr/local/bin/mysql
reboot
update-rc.d -f mysql.server defaults
/etc/init.d/mysql.server start
/etc/init.d/mysql.server status
mysql -u root -p
https://www.youtube.com/c/musaamin/videos
https://www.youtube.com/c/musaamin/videos
install lampp
sudo /opt/lampp/lampp start
Starting XAMPP for Linux 7.2.18-1...
XAMPP: Starting Apache...fail.
XAMPP: Another web server is already running.
XAMPP: Starting MySQL...ok.
XAMPP: Starting ProFTPD...ok.
sudo systemctl stop apache2
sudo systemctl disable apache2
sudo systemctl stop mysql
sudo systemctl disable mysql
File konfigurasi XAMPP:
Apache configuration file: /opt/lampp/etc/httpd.conf, /opt/lampp/etc/extra/httpd-xampp.conf
PHP configuration file: /opt/lampp/etc/php.ini
MySQL configuration file: /opt/lampp/etc/my.cnf
ProFTPD configuration file: /opt/lampp/etc/proftpd.conf
Direktori penting XAMPP:
Direktori Document Root: /opt/lampp/htdocs
Direktori database: /opt/lampp/var/mysql
Direktori konfigurasi: /opt/lampp/etc
cd /opt/lampp/htdocs
sudo mkdir webku.com
sudo chown $USER.$USER webku.com
sudo gedit /opt/lampp/etc/httpd.conf
# Virtual hosts
#Include etc/extra/httpd-vhosts.conf
TO.....
# Virtual hosts
Include etc/extra/httpd-vhosts.conf
Selanjutnya buka file konfigurasi virtual hosts httpd-vhosts.conf .....
sudo gedit /opt/lampp/etc/extra/httpd-vhosts.conf
Before ...
<VirtualHost *:80>
ServerAdmin [email protected]
DocumentRoot "/opt/lampp/docs/dummy-host.example.com"
ServerName dummy-host.example.com
ServerAlias www.dummy-host.example.com
ErrorLog "logs/dummy-host.example.com-error_log"
CustomLog "logs/dummy-host.example.com-access_log" common
</VirtualHost>
<VirtualHost *:80>
ServerAdmin [email protected]
DocumentRoot "/opt/lampp/docs/dummy-host2.example.com"
ServerName dummy-host2.example.com
ErrorLog "logs/dummy-host2.example.com-error_log"
CustomLog "logs/dummy-host2.example.com-access_log" common
</VirtualHost>
AFTER ...
<VirtualHost *:80>
ServerName localhost
DocumentRoot /opt/lampp/htdocs
ErrorLog "logs/localhost.error.log"
CustomLog "logs/localhost.access.log" common
</VirtualHost>
<VirtualHost *:80>
ServerName webku.com
DocumentRoot /opt/lampp/htdocs/webku.com
ErrorLog "logs/webku.com.error.log"
CustomLog "logs/webku.com.access.log" common
</VirtualHost>
sudo gedit /etc/hosts
127.0.0.1 webku.com
sudo /opt/lampp/lampp reloadapache
https://musaamin.web.id/cara-install-dan-setting-xampp-for-linux/
https://musaamin.web.id/cara-install-dan-setting-xampp-for-linux/
https://musaamin.web.id/cara-install-sistem-informasi-desa-opensid-di-ubuntu-18-04/
https://musaamin.web.id/cara-install-sistem-informasi-desa-opensid-di-ubuntu-18-04/
sudo apt install apache2 -y
cd /etc/apache2/sites-available
sudo nano desaindah.id.conf
<VirtualHost *:80>
ServerName www.desaindah.id
ServerAlias desaindah.id
DocumentRoot /var/www/desaindah.id
<Directory /var/www/desaindah.id>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Require all granted
</Directory>
ErrorLog /var/log/apache2/desaindah.id.error.log
CustomLog /var/log/apache2/desaindah.id.access.log combined
</VirtualHost>
sudo a2ensite desaindah.id.conf
sudo a2enmod rewrite
sudo systemctl restart apache2
sudo systemctl status apache2
cd /var/www
sudo mkdir desaindah.id
sudo nano desaindah.id/test.html
sudo rm /var/www/desaindah.id/test.html
sudo apt install php php-common php-mysql php-gd php-cli libapache2-mod-php -y
sudo apt install mariadb-server mariadb-client -y
sudo mysql_secure_installation
Enter current password for root (enter for none): ENTER
Set root password? [Y/n] y
New password: PASSWORD_ROOT
Re-enter new password: MASUKKAN_ULANG_PASSWORD_ROOT
Remove anonymous users? [Y/n] y
Disallow root login remotely? [Y/n] y
Remove test database and access to it? [Y/n] y
Reload privilege tables now? [Y/n] y
sudo mysql -u root -p
create database opensid;
create user 'user_opensid'@'localhost' identified by 'pass_opensid';
grant all privileges on opensid.* to 'user_opensid'@'localhost';
flush privileges;
wget https://github.com/OpenSID/OpenSID/archive/v19.07.zip -O OpenSID-v19.07.zip
unzip OpenSID*.zip
sudo cp -Rv OpenSID-19.07/* /var/www/desaindah.id/
cd /var/www/desaindah.id
sudo cp -Rv desa-contoh desa
sudo chown -R $USER:www-data ../desaindah.id
sudo chmod -R 775 ../desaindah.id
mysql -u user_opensid -p opensid < desaindah.id/contoh_data_awal_20190701.sql
nano desa/config/database.php
$db['default']['hostname'] = 'localhost';
$db['default']['username'] = 'user_opensid';
$db['default']['password'] = 'pass_opensid';
$db['default']['database'] = 'opensid';
Akses laman admin OpenSID http://desaindah.id/index.php/siteman, username = admin, password = sid304.
https://github.com/OpenSID/OpenSID
https://github.com/OpenSID/OpenSID/wiki
https://demo.opensid.or.id/
https://www.facebook.com/groups/opensid
https://www.howtoforge.com/tutorial/ubuntu-lts-minimal-server/
https://www.howtoforge.com/tutorial/ubuntu-lts-minimal-server/
https://www.howtoforge.com/ubuntu_lamp_for_newbies
sudo apt-get install apache2
http://localhost/
sudo apt-get install php5 libapache2-mod-php5
sudo /etc/init.d/apache2 restart
sudo gedit /var/www/testphp.php
<?php phpinfo(); ?>
sudo apt-get install mysql-server
gksudo gedit /etc/mysql/my.cnf
bind-address = 127.0.0.1
mysql -u root
mysql> SET PASSWORD FOR 'root'@'localhost' = PASSWORD('yourpassword');
sudo apt-get install libapache2-mod-auth-mysql php5-mysql phpmyadmin
gksudo gedit /etc/php5/apache2/php.ini
;extension=mysql.so
extension=mysql.so
sudo /etc/init.d/apache2 restart
https://www.digitalocean.com/community/tutorials/how-to-install-linux-apache-mariadb-php-lamp-stack-debian9
https://www.digitalocean.com/community/tutorials/how-to-install-linux-apache-mariadb-php-lamp-stack-debian9
sudo apt update
sudo apt install apache2
sudo ufw app list
sudo ufw app info "WWW Full"
sudo ufw allow in "WWW Full"
ip addr show eth0 | grep inet | awk '{ print $2; }' | sed 's/\/.*$//'
sudo apt install curl
curl http://icanhazip.com
sudo apt install mariadb-server
sudo mysql_secure_installation
sudo mariadb
GRANT ALL ON *.* TO 'admin'@'localhost' IDENTIFIED BY 'password' WITH GRANT OPTION;
FLUSH PRIVILEGES;
exit
mariadb -u admin -p
sudo apt install php libapache2-mod-php php-mysql
sudo nano /etc/apache2/mods-enabled/dir.conf
/etc/apache2/mods-enabled/dir.conf
<IfModule mod_dir.c>
DirectoryIndex index.html index.cgi index.pl index.php index.xhtml index.htm
</IfModule>
sudo systemctl restart apache2
apt search php- | less
apt show package_name
apt show php-cli
sudo apt install php-cli
sudo apt install package1 package2 ...
sudo nano /var/www/html/info.php
http://your_server_ip/info.php
sudo rm /var/www/html/info.php
https://medium.com/@dataq/instalasi-linux-apache-mysql-php-lamp-stack-pada-ubuntu-16-04-b243d3048b35
https://medium.com/@dataq/instalasi-php-apache-module-pada-ubuntu-16-04-481d288a909d
https://medium.com/@dataq/instalasi-apache-dan-php-fpm-pada-ubuntu-16-04-cd8900b5d529
1. Instalasi Apache
$ sudo apt update
$ sudo apt install apache2
alamat IP atau alamat domain server anda tersebut, misalkan http://mydomain.com/ atau http://104.16.123.127/.
Konfig firewall
sudo ufw app list
sudo ufw app info "Apache Full"
Untuk mengijinkan incoming packet dengan port dan protocol dalam application profile Apache Full, jalankan perintah:
sudo ufw allow in "Apache Full"
Jangan lupa untuk mengijinkan pula incoming packet dengan application profile OpenSSH dengan perintah:
sudo ufw allow in "OpenSSH"
$ sudo ufw status
$ sudo ufw enable
3. Menyembunyikan Informasi Terkait Apache
Menyembunyikan informasi terkait web server Apache, seperti versi Apache dan sistem operasi, sebenarnya bersifat optional karena informasi tersebut bukanlah sebuah vulnerability. Namun menyembunyikan informasi ini adalah langkah pencegahan untuk mempersulit penyerang dalam menemukan vulnerability yang ada pada aplikasi yang terpasang pada server.
Ada dua konfigurasi Apache yang perlu kita ubah, yaitu ServerSignature dan ServerTokens. Bukalah file /etc/apache2/conf-available/security.conf kemudian ubahlah konfigurasiServerTokensmenjadi:
ServerTokens Prod
dan konfigurasi ServerSignature menjadi:
ServerSignature Off
Simpan perubahan tersebut lalu restart service Apache dengan perintah:
$ sudo systemctl restart apache2.service
https://medium.com/tag/web-server
https://medium.com/tag/web-server
https://blog.panoply.io/a-comparative-vmariadb-vs-mysql
sudo apt-get update
sudo apt-get install mysql-server
mysql_secure_installation
mysql -u root -p
https://akaabachi.medium.com/respect-of-the-kill-how-to-properly-terminate-your-linux-processes-99f6025f2e53
$ sudo apt-get update
$ sudo apt-get install mariadb-server
$ sudo mysql_secure_installation
Secara default user root menggunakan unix_socket untuk autentikasi, sehingga kita dapat login menggunakan user root tanpa password. Anda cukup menekan enter ketika anda diminta memasukkan current password for root. Anda juga tidak perlu merubah password root ketika menemui opsi Set root password?. Jawablah tiap pertanyaan pada yang muncul sesuai dengan tingkat keamanan yang anda inginkan. Berikut adalah contoh konfigurasi yang saya rekomendasikan:
NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MariaDB SERVERS IN PRODUCTION USE! PLEASE READ EACH STEP CAREFULLY!In order to log into MariaDB to secure it, we'll need the current
password for the root user. If you've just installed MariaDB, and
you haven't set the root password yet, the password will be blank,
so you should just press enter here.Enter current password for root (enter for none):
OK, successfully used password, moving on...Setting the root password ensures that nobody can log into the MariaDB
root user without the proper authorisation.Set root password? [Y/n] n
... skipping.By default, a MariaDB installation has an anonymous user, allowing anyone
to log into MariaDB without having to have a user account created for
them. This is intended only for testing, and to make the installation
go a bit smoother. You should remove them before moving into a
production environment.Remove anonymous users? [Y/n] Y
... Success!Normally, root should only be allowed to connect from 'localhost'. This
ensures that someone cannot guess at the root password from the network.Disallow root login remotely? [Y/n] Y
... Success!By default, MariaDB comes with a database named 'test' that anyone can
access. This is also intended only for testing, and should be removed
before moving into a production environment.Remove test database and access to it? [Y/n] Y
- Dropping test database...
... Success!
- Removing privileges on test database...
... Success!Reloading the privilege tables will ensure that all changes made so far
will take effect immediately.Reload privilege tables now? [Y/n] Y
... Success!Cleaning up...All done! If you've completed all of the above steps, your MariaDB
installation should now be secure.Thanks for using MariaDB!
. Mengecek Hasil Instalasi MariaDB
Setelah anda selesai melakukan instalasi program tersebut anda dapat mengecek koneksi ke database dengan perintah:
$ sudo mysql
Menambahkan Administrator User
Saran saya, anda perlu menambahkan user selain root untuk melakukan administrasi database MariaDB anda, dan tentunya user tersebut dilengkapi dengan password. Tujuannya agar user yang tidak memiliki hak aksessudo tetap dapat mengelola MariaDB. Langkah pertama, anda perlu masuk ke dalam terminal MariaDB dengan perintah
$ sudo mysql
Buatlah user baru disertai dengan domain. Bila user tersebut hanya boleh mengakses di komputer yang sama, maka tambahkah @localhost di belakang username, misalnya
CREATE USER 'admin'@'localhost' IDENTIFIED BY 'difficultpassword';
Berikan hal akses administrator dengan perintah
GRANT ALL PRIVILEGES ON *.* TO 'admin'@'localhost' WITH GRANT OPTION;
lalu flush privilege
FLUSH PRIVILEGES;
Keluarlah dari terminal MariaDB dengan perintah exit. Kemudian login kembali dengan user baru tersebut tanpa sudo
$ mysql -u admin -p
3. Instalasi PHP
Ada dua pilihan instalasi PHP, yaitu instalasi PHP sebagai bagian dari Apache Module atau instalasi PHP menggunakan PHP-FPM yang terpisah dari Apache. Masing-masing memiliki keunggulan dan kelemahan sendiri. Dari segi kemudahan, instalasi PHP sebagai bagian dari Apache Module memang lebih mudah, namun dari segi fleksibilitas PHP-FPM lebih unggul. Sebagai contoh, kita dapat melakukan instalasi beberapa versi PHP dalam satu server sekaligus menggunakan PHP-FPM.
Opsi 1: PHP Menggunakan Apache Module
Bila anda telah memutuskan untuk menggunakan PHP dalam Apache Module, maka anda dapat mengikuti tutorial yang saya tuliskan pada artikel berikut
https://medium.com/@dataq/instalasi-php-apache-module-pada-ubuntu-16-04-481d288a909d
1. Instalasi PHP Apache Module
PHP dapat dipasang sebagai bagian dari Apache module. Cara ini adalah cara yang paling mudah dalam mengkombinasikan web server Apache dan PHP. Namun konsekuensinya adalah PHP akan mewarisi permission dari proses Apache. Hal ini tentunya akan berdampak pada aspek keamanan pada server anda. Lebih lanjut tentang aspek keamanan ini dapat anda baca pada PHP manual berikut
Langkah pertama dalam melakukan instalasi PHP sebagai bagian dari Apache module adalah dengan menjalankan perintah
$ sudo apt update
$ sudo apt install php libapache2-mod-php
Untuk mengecek apakah PHP telah berjalan di server anda, anda dapat membuat sebuah file dengan isi
<?php
phpinfo();
?>
di root directory server yang secara default berada di /var/www/html/, misalkan dengan nama file /var/www/html/info.php.
Default owner directory /var/www/html/ adalah root, sehingga anda memerlukan hak akses root untuk membuat atau memodifikasi file dalam directory tersebut.
Kemudian cobalah akses file tersebut menggunakan web browser, misalnya dengan mengakses http://<domain server anda>/info.php atau http://<alamat IP server anda>/info.php. Bila anda mendapatkan output seperti pada Gambar 1 berarti proses instalasi PHP telah berhasil.
Pada Ubuntu 16.04 versi PHP yang digunakan adalah versi 7.0. Bila anda memerlukan versi lama atau versi lebih baru, maka anda harus menggunakan cara yang berbeda yang tidak dibahas dalam artikel ini.
Modifikasi Konfigurasi PHP
Tanpa langkah berikut, sebenarnya instalasi PHP tersebut telah dapat digunakan, namun kadang kita perlu melakukan beberapa modifikasi untuk menyesuaikan dengan kebutuhan program PHP yang nantinya kita buat.
Instalasi MySQL module
Bila anda ingin menggunakan PHP untuk mengolah RDBMS MySQL atau MariaDB, maka anda perlu mengaktifkan PHP MySQL module dengan cara menjalankan perintah
$ sudo apt install php-mysql
$ sudo systemctl restart apache2.service
<?php
$servername = "localhost";
$username = "root";
$password = "secret";
$conn = new mysqli($servername, $username, $password);
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
} else {
echo("Connection success.");
}
$conn->close();
?>
Kemudian akses file tersebut menggunakan web browser, misalnya dengan mengakses http://<domain server anda>/mysql.php atau http://<alamat IP server anda>/mysql.php. Jangan lupa, anda perlu mengganti $servername, $username, dan $password pada script untuk disesuaikan dengan konfigurasi server anda. Bila output script tersebut adalah
Connection success.
maka instalasi anda berhasil, namun bila tidak maka berarti ada masalah dengan proses instalasi yang anda lakukan.
Pencarian dan Instalasi Berbagai Modul PHP
Untuk meningkatkan fungsionalitas dari PHP, anda dapat menambahkan beberapa modul tambahan ke dalam PHP. Untuk mencari modul-modul yang tersedia dalam repository, gunakanlah perintah
$ sudo apt-cache search php-
Bila anda ingin pencarian yang lebih spesifik, kombinasikan dengan perintah grep, misalnya anda ingin mencari modul PHP yang berkaitan dengan zip, maka anda dapat menggunakan perintah
$ sudo apt-cache search php- | grep zip
Contoh output dari perintah tersebut adalah
libphp-pclzip - transitional dummy package
php-bz2 - bzip2 module for PHP [default]
php-pclzip - ZIP archive manager class for PHP
php-zip - Zip module for PHP [default]
php-zipstreamer - Stream zip files without i/o overhead
php7.0-bz2 - bzip2 module for PHP
php7.0-zip - Zip module for PHP
Bila anda sudah memutuskan modul apa yang perlu anda install, misalnya php-zip, maka gunakan perintah apt install untuk melakukan instalasi PHP modul tersebut. Berikut adalah contoh perintah untuk melakukan instalasi modul php-zip
$ sudo apt install php-zip
Kemudian restart service Apache dengan perintah
$ sudo systemctl restart apache2.service
Menyembunyikan Versi PHP pada HTTP Header
Bila anda tidak menginginkan versi PHP anda tampil pada HTTP Header, demi alasan keamanan misalnya, maka anda dapat memodifikasi file /etc/php/7.0/apache2/php.ini dan /etc/php/7.0/cli/php.ini. Pastikan variable expose_php pada kedua file tersebut bernilai Off seperti ini.
expose_php = Off
Kemudian restart service Apache dengan perintah
$ sudo systemctl restart apache2.service
Mengganti Default Directory Index
Bila anda memiliki dua file index, misalnya index.html dan index.php, dalam satu directory yang sama, maka yang dieksekusi oleh Apache adalah file index.html. Bila anda ingin mengubah urutan prioritas file index, maka anda dapat mengaturnya melalui file /etc/apache2/mods-available/dir.conf.
Ubahlah urutan index.php pada DirectoryIndex yang semula pada urutan keempat seperti ini
<IfModule mod_dir.c>
DirectoryIndex index.html index.cgi index.pl index.php index.xhtml index.htm
</IfModule>
menjadi urutan pertama seperti ini
<IfModule mod_dir.c>
DirectoryIndex index.php index.html index.cgi index.pl index.xhtml index.htm
</IfModule>
Kemudian restart service Apache dengan perintah
sudo systemctl restart apache2.service
https://medium.com/@dataq/instalasi-apache-dan-php-fpm-pada-ubuntu-16-04-cd8900b5d529
https://medium.com/@dataq/instalasi-apache-dan-php-fpm-pada-ubuntu-16-04-cd8900b5d529
Instalasi Apache dan PHP-FPM pada Ubuntu 16.04
Mahendra Data
Mahendra Data
Jun 13, 2018·4 min read
PHP-FPM (FastCGI Process Manager) adalah implementasi FastCGI alternatif untuk bahasa PHP. PHP-FPM merupakan interpreter PHP yang terpisah dari aplikasi web server. Setiap request atas script PHP yang masuk ke web server akan diteruskan (forward) ke FastCGI melalui socket atau koneksi TCP/IP. Pada artikel ini kita akan membahas langkah-langkah dalam membangun web server dengan PHP-FPM.
Sebelum mengikuti langkah-langkah dalam membangun web server dengan PHP-FPM dalam artikel ini, anda perlu melakukan instalasi web server Apache terlebih dahulu. Anda dapat mengikuti langkah yang telah saya tuliskan dalam artikel berikut
1. Instalasi PHP-FPM
Langkah pertama adalah dengan melakukan instalasi php-fpm dan modul fastcgi apache dengan perintah:
$ sudo apt update
$ sudo apt install php-fpm libapache2-mod-fastcgi
Aktifkan modul actions, fastcgi, cgid dan alias dengan perintah
$ sudo a2enmod actions fastcgi cgid alias
kemudian tambahkan script pada Gambar 1 ke dalam file VirtualHost server anda, misalnya dalam file /etc/apache2/sites-available/000-default.conf. Bila anda memiliki beberapa VirtualHost maka script pada Gambar 1 perlu anda tambahkan pada semua VirtualHost yang anda gunakan.
Alias /php7-fcgi /usr/lib/cgi-bin/php7-fcgi
FastCgiExternalServer /usr/lib/cgi-bin/php7-fcgi -socket /var/run/php/php7.0-fpm.sock -pass-header Authorization
<FilesMatch \.php$>
SetHandler application/x-httpd-php
Action application/x-httpd-php /php7-fcgi
</FilesMatch>
Restart service Apache untuk mengaktifkan konfigurasi tersebut dengan perintah
$ sudo systemctl restart apache2.service
Untuk mengecek apakah konfigurasi tersebut berhasil, buatlah sebuah file PHP berisi
<?php
phpinfo();
?>
dalam root directory (misalnya /var/www/html/info.php). Kemudian akseslah menggunakan web browser, misalnya dengan mengakses http://<domain server anda>/info.php atau http://<alamat IP server anda>/info.php.
Perhatikan nilai Server API pada Gambar 2. Bila nilainya adalah FPM/FastCGI, maka artinya proses instalasi PHP -FPM telah berhasil.
Konfigurasi VirtualHost pada Gambar 1 menggunakan socket untuk menghubungkan Apache dengan PHP-FPM yang berada dalam satu server yang sama. Bila Apache dengan PHP-FPM berada dalam server yang terpisah maka anda harus menggunakan koneksi TCP/IP, namun cara tersebut tidak dibahas dalam artikel ini.
2. Modifikasi Konfigurasi PHP
Tanpa langkah berikut, sebenarnya instalasi PHP tersebut telah dapat digunakan, namun kadang kita perlu melakukan beberapa modifikasi untuk menyesuaikan dengan kebutuhan program PHP yang nantinya kita buat.
Modifikasi cgi.fix_pathinfo
Modifikasi bagian cgi.fix_pathinfo sangat penting dilakukan demi alasan keamanan. Yang perlu kita lakukan adalah membuka file /etc/php/7.0/fpm/php.ini dan mengubah
;cgi.fix_pathinfo=1
menjadi
cgi.fix_pathinfo=0
kemudian me-restart service PHP-FPM dengan perintah
$ sudo systemctl restart php7.0-fpm.service
Modifikasi ini sangat penting dilakukan untuk mencegah PHP mengeksekusi file dengan nama yang paling mirip bila file dengan nama yang sama persis tidak ditemukan.
Instalasi MySQL module
Bila anda ingin menggunakan PHP untuk mengolah RDBMS MySQL atau MariaDB, maka anda perlu mengaktifkan PHP MySQL module dengan cara menjalankan perintah
$ sudo apt install php-mysql
kemudian anda perlu me-restart service PHP-FPM dengan perintah
$ sudo systemctl restart php7.0-fpm.service
Untuk memastikan bahwa modul php-mysql telah aktif, buatlah sebuah file di root directory server, misalnya /var/www/html/mysql.php dengan isi
<?php
$servername = "localhost";
$username = "root";
$password = "secret";
$conn = new mysqli($servername, $username, $password);
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
} else {
echo("Connection success.");
}
$conn->close();
?>
kemudian akses file tersebut menggunakan web browser, misalnya dengan mengakses http://<domain server anda>/mysql.php atau http://<alamat IP server anda>/mysql.php. Jangan lupa, anda perlu mengganti $servername, $username, dan $password pada script untuk disesuaikan dengan konfigurasi server anda. Bila output script tersebut adalah
Connection success.
maka instalasi anda berhasil, namun bila tidak maka berarti ada masalah dengan proses instalasi yang anda lakukan.
Pencarian dan Instalasi Berbagai Modul PHP
Untuk meningkatkan fungsionalitas dari PHP, anda dapat menambahkan beberapa modul tambahan ke dalam PHP. Untuk mencari modul-modul yang tersedia dalam repository, gunakanlah perintah
$ sudo apt-cache search php-
Bila anda ingin pencarian yang lebih spesifik, kombinasikan dengan perintah grep, misalnya anda ingin mencari modul PHP yang berkaitan dengan zip, maka anda dapat menggunakan perintah
$ sudo apt-cache search php- | grep zip
Contoh output dari perintah tersebut adalah
libphp-pclzip - transitional dummy package
php-bz2 - bzip2 module for PHP [default]
php-pclzip - ZIP archive manager class for PHP
php-zip - Zip module for PHP [default]
php-zipstreamer - Stream zip files without i/o overhead
php7.0-bz2 - bzip2 module for PHP
php7.0-zip - Zip module for PHP
Bila anda sudah memutuskan modul apa yang perlu anda install, misalnya php-zip, maka gunakan perintah apt install untuk melakukan instalasi PHP modul tersebut. Berikut adalah contoh perintah untuk melakukan instalasi modul php-zip
$ sudo apt install php-zip
Kemudian restart service PHP-FPM dengan perintah
$ sudo systemctl restart php7.0-fpm.service
Menyembunyikan Versi PHP pada HTTP Header
Bila anda tidak menginginkan versi PHP anda tampil pada HTTP Header, demi alasan keamanan misalnya, maka anda dapat memodifikasi file /etc/php/7.0/fpm/php.ini dan /etc/php/7.0/cli/php.ini. Pastikan variable expose_php pada kedua file tersebut bernilai Off seperti ini.
expose_php = Off
Kemudian restart service PHP-FPM dengan perintah
$ sudo systemctl restart php7.0-fpm.service
Mengganti Default Directory Index
Bila anda memiliki dua file index, misalnya index.html dan index.php, dalam satu directory yang sama, maka yang dieksekusi oleh Apache adalah file index.html. Bila anda ingin mengubah urutan prioritas file index, maka anda dapat mengaturnya melalui file /etc/apache2/mods-available/dir.conf.
Ubahlah urutan index.php pada DirectoryIndex yang semula pada urutan keempat seperti ini
<IfModule mod_dir.c>
DirectoryIndex index.html index.cgi index.pl index.php index.xhtml index.htm
</IfModule>
menjadi urutan pertama seperti ini
<IfModule mod_dir.c>
DirectoryIndex index.php index.html index.cgi index.pl index.xhtml index.htm
</IfModule>
Kemudian restart service Apache dengan perintah
sudo systemctl restart apache2.service
https://medium.com/@dataq/instalasi-apache-dan-php-fpm-pada-ubuntu-16-04-cd8900b5d529
https://medium.com/@dataq/instalasi-apache-dan-php-fpm-pada-ubuntu-16-04-cd8900b5d529
https://medium.com/@dataq/instalasi-apache-dan-php-fpm-pada-ubuntu-16-04-cd8900b5d529
https://medium.com/@dataq/instalasi-web-server-apache-pada-ubuntu-16-04-6d3aa768886d
https://medium.com/@dataq/instalasi-web-server-apache-pada-ubuntu-16-04-6d3aa768886d
https://vishnuswmech.medium.com/setting-up-your-own-high-availability-managed-wordpress-hosting-using-amazon-rds-d215060a13b5
https://vishnuswmech.medium.com/setting-up-your-own-high-availability-managed-wordpress-hosting-using-amazon-rds-d215060a13b5
https://www.php.net/manual/en/security.apache.php
https://www.php.net/manual/en/security.apache.php
https://medium.com/cloud-believers/four-great-apache-systems-for-big-data-and-data-lake-apache-shardingsphere-apache-iceberg-238485129944
https://medium.com/cloud-believers/four-great-apache-systems-for-big-data-and-data-lake-apache-shardingsphere-apache-iceberg-238485129944
https://www.howtoforge.com/tutorial/install-apache-with-php-and-mysql-on-ubuntu-16-04-lamp/
https://www.howtoforge.com/tutorial/install-apache-with-php-and-mysql-on-ubuntu-16-04-lamp/
https://www.howtoforge.com/tutorial/install-apache-with-php-and-mysql-on-ubuntu-16-04-lamp/
https://www.howtoforge.com/tutorial/install-apache-with-php-and-mysql-on-ubuntu-18-04-lamp/
https://www.howtoforge.com/tutorial/install-apache-with-php-and-mysql-on-ubuntu-18-04-lamp/
https://medium.com/@dataq/instalasi-linux-apache-mysql-php-lamp-stack-pada-ubuntu-16-04-b243d3048b35
https://medium.com/@dataq/instalasi-linux-apache-mysql-php-lamp-stack-pada-ubuntu-16-04-b243d3048b35
https://medium.com/@dataq/instalasi-linux-apache-mysql-php-lamp-stack-pada-ubuntu-16-04-b243d3048b35
https://medium.com/@dataq/instalasi-linux-apache-mysql-php-lamp-stack-pada-ubuntu-16-04-b243d3048b35
https://medium.com/tag/web-server
https://medium.com/tag/apache
https://medium.com/tag/docker
https://medium.com/tag/docker
https://medium.com/tag/servers
https://medium.com/tag/servers
https://medium.com/tag/web-development
https://medium.com/tag/web-development
https://medium.com/tag/nginx
https://medium.com/tag/nginx
https://medium.com/tag/nginx
https://medium.com/tag/nodejs
https://medium.com/tag/nodejs
https://medium.com/tag/nodejs
https://medium.com/tag/servers
https://medium.com/tag/servers
https://medium.com/tag/servers
https://medium.com/@maneesha.wijesinghe1?source=---------2-----------------------
https://medium.com/@maneesha.wijesinghe1?source=---------2-----------------------
https://medium.com/pcmag-access?source=---------3-----------------------
https://medium.com/pcmag-access?source=---------3-----------------------
https://medium.com/geekculture/designing-a-websocket-server-in-golang-reformers-golang-implementation-strategy-bcd2dc9e368e
https://medium.com/geekculture/designing-a-websocket-server-in-golang-reformers-golang-implementation-strategy-bcd2dc9e368e
https://medium.com/geekculture/designing-a-websocket-server-in-golang-reformers-golang-implementation-strategy-bcd2dc9e368e
https://towardsdatascience.com/python-webserver-with-flask-and-raspberry-pi-398423cc6f5d
https://towardsdatascience.com/python-webserver-with-flask-and-raspberry-pi-398423cc6f5d
https://itnext.io/immutable-infrastructure-using-packer-ansible-and-terraform-7ca6f79582b8
https://itnext.io/immutable-infrastructure-using-packer-ansible-and-terraform-7ca6f79582b8
https://www.cloudbooklet.com/how-to-install-lamp-apache-mysql-php-in-ubuntu-20-04/
https://www.cloudbooklet.com/how-to-install-lamp-apache-mysql-php-in-ubuntu-20-04/
https://www.tecmint.com/install-apache-mariadb-php-phpmyadmin-in-ubuntu-14-10/
https://www.tecmint.com/install-apache-mariadb-php-phpmyadmin-in-ubuntu-14-10/
https://sekolahlinux.com/category/linux/ubuntu/
https://sekolahlinux.com/category/linux/ubuntu/
https://sekolahlinux.com/merubah-apache-server-name-dengan-mod_security-pada-ubuntu-dan-centos/
https://sekolahlinux.com/merubah-apache-server-name-dengan-mod_security-pada-ubuntu-dan-centos/
https://www.liquidweb.com/kb/how-to-install-and-configure-phpmyadmin-on-centos-7/
https://www.liquidweb.com/kb/how-to-install-and-configure-phpmyadmin-on-centos-7/
https://www.liquidweb.com/kb/how-to-install-and-configure-phpmyadmin-on-centos-7/
https://www.tecmint.com/install-lamp-in-centos-7/
https://www.tecmint.com/install-lamp-in-centos-7/
https://www.tecmint.com/install-lamp-in-centos-7/
https://www.tecmint.com/install-phpmyadmin-rhel-centos-fedora-linux/
https://www.tecmint.com/install-phpmyadmin-rhel-centos-fedora-linux/
https://www.digitalocean.com/community/tutorials/how-to-install-linux-apache-mysql-php-lamp-stack-on-centos-7
https://www.digitalocean.com/community/tutorials/how-to-install-linux-apache-mysql-php-lamp-stack-on-centos-7
https://tecadmin.net/install-phpmyadmin-on-centos/
https://tecadmin.net/install-phpmyadmin-on-centos/
https://www.rosehosting.com/blog/how-to-install-phpmyadmin-on-centos-7/
https://www.rosehosting.com/blog/how-to-install-phpmyadmin-on-centos-7/
https://www.rosehosting.com/blog/how-to-install-phpmyadmin-on-centos-7/
http://httpd.apache.org/docs/current/mod/mod_rewrite.html
http://httpd.apache.org/docs/current/mod/mod_rewrite.html
http://httpd.apache.org/docs/current/mod/mod_rewrite.html
https://docs.joomla.org/How_do_UNIX_file_permissions_work%3F
https://docs.joomla.org/How_do_UNIX_file_permissions_work%3F
https://docs.joomla.org/How_do_UNIX_file_permissions_work%3F
https://www.labanapost.com/2008/09/linux/pengalaman-upgrade-hardisk-laptop-di-linux/
https://www.labanapost.com/2010/05/linux/gunakan-partisi-terbesar-di-server-amazon-ec2/
https://www.labanapost.com/2008/09/linux/pentingnya-membagi-partisi-di-linux/
https://www.labanapost.com/2007/05/linux/mengetahui-informasi-hardisk-atau-usb-flashdisk-di-linux/
https://www.digitalocean.com/community/tutorials/how-to-install-wordpress-with-lamp-on-ubuntu-18-04
https://www.digitalocean.com/community/tutorials/how-to-install-wordpress-with-lamp-on-ubuntu-18-04
https://www.dewaweb.com/blog/cara-instal-node-js-dan-deploy-app-di-centos-8/
https://www.dewaweb.com/blog/cara-instal-node-js-dan-deploy-app-di-centos-8/
https://www.dewaweb.com/blog/cara-melakukan-speedtest-server-di-centos-7/
https://www.dewaweb.com/blog/cara-melakukan-speedtest-server-di-centos-7/
https://www.dewaweb.com/blog/cara-instalasi-go-atau-golang-di-centos-7/
https://www.dewaweb.com/blog/cara-instalasi-go-atau-golang-di-centos-7/
https://www.dewaweb.com/blog/tag/lamp-stack/ubuntu/
https://www.dewaweb.com/blog/tag/lamp-stack/ubuntu/
https://www.dewaweb.com/blog/cara-install-mikrotik-chr-pada-server-dengan-centos-8/
https://www.dewaweb.com/blog/cara-install-mikrotik-chr-pada-server-dengan-centos-8/
https://www.dewaweb.com/blog/tag/centos/
https://www.dewaweb.com/blog/tag/centos/
https://www.dewaweb.com/blog/cara-install-mikrotik-chr-pada-server-dengan-centos-8/
https://www.dewaweb.com/blog/cara-install-mikrotik-chr-pada-server-dengan-centos-8/
https://www.dewaweb.com/blog/cara-install-mikrotik-chr-pada-server-dengan-centos-8/
https://www.tecmint.com/change-a-users-default-shell-in-linux/
https://www.tecmint.com/change-a-users-default-shell-in-linux/
https://www.tecmint.com/screen-command-examples-to-manage-linux-terminals/
https://www.tecmint.com/screen-command-examples-to-manage-linux-terminals/
https://www.tecmint.com/screen-command-examples-to-manage-linux-terminals/
https://www.vultr.com/
https://tempel.in/trends
https://tempel.in/trends
https://tempel.in/trends
https://semawur.com/6ighyqUMduuQ
https://tempel.in/view/6737f5c1
https://tempel.in/view/d47c3e91
https://tempel.in/view/4feac358
https://tempel.in/view/c8769226
Dibawah ini kumpulan Artikel Blog sesuai dengan niche nya. Jangan lupa share ke yang lain.
6450 Artikel Seo Tentang Kesehatan
http://bit.ly/6450kesehatan
11850 Artikel Seo Tentang Pendidikan
http://bit.ly/11850Pendidikan
20000 Artikel Seo Tentang lirik lagi
http://bit.ly/20000Lirik
https://www.gnome-look.org/browse/ord/rating
https://pkgs.org/download/net-tools
https://media.neliti.com/media/publications/174408-ID-remastering-distro-ubuntu-untuk-menunjan.pdf
https://www.cacti.net/downloads
http://www.sugengsiswanto.com/2015/01/install-remastersys-untuk-remastering-ubuntu-linux.html
https://docplayer.info/185764-Cara-cepat-mudah-remastering-ubuntu-menggunakan-remastersys-source-situs-resmi-how-to-remastersys.html
https://docplayer.info/185764-Cara-cepat-mudah-remastering-ubuntu-menggunakan-remastersys-source-situs-resmi-how-to-remastersys.html
https://id.wikipedia.org/wiki/Daftar_rilis_Ubuntu
https://darmakusumandaru.blogspot.com/2016/06/tutorial-remastering-linux-ubuntu-1404.html
https://langittutorial.blogspot.com/2017/12/cara-install-dan-menggunakan-respin-remastering-tool-ubuntu-16.html
https://www.gnome-look.org/p/1365372
https://docplayer.info/56989336-Remaster-distro-linux-ubuntu-lts-menggunakan-remastersys-tugas-akhir.html
https://tutorialkreasikotakpensildarikardus.blogspot.com/2019/11/koleksi-tutorial-remastering-ubuntu.html
http://blog.ub.ac.id/izuaf/2012/01/10/remastering-menggunakan-uck-ubuntu-customization-kit
https://issuu.com/arifinlperz/docs/buku_remaster_ubuntu
https://issuu.com/arifinlperz/docs/buku_remaster_ubuntu
https://www.indonesianbacktrack.or.id/forum/thread-5582.html
https://www.proweb.co.id/articles/virtualbox/networking-mode.html
https://www.pintarkomputer.com/virtualbox-cara-mudah-koneksikan-komputer-host-pc-asli-dengan-komputer-guest-virtua
https://www.ayies.com/membuat-virtualbox-2-ethernet-dengan-ip-public-internet-dan-ip-private-lokal-akses-dari-host
------------------------
https://docs.joomla.org/Configuring_a_LAMPP_server_for_PHP_development/Linux_desktop
sudo apt-get install apache2 php5-mysql libapache2-mod-php5 mysql-server phpmyadmin php5-curl
cek localhost after install
echo "<?php phpinfo(); ?>" | sudo tee /var/www/html/test.php
Apache Default Web Site Folder
Location: "/var/www/"
Apache Web Sites Configuration Files
Location: /etc/apache2/sites-available/
Apache Configuration Files
Location: "/etc/apache2/apache2.conf" Location: "/etc/apache2/envvars"
Apache Ports Configuration File
Location: "/etc/apache2/ports.conf"
Apache Log Files
Location: "/var/log/apache2/"
Configuration
Enabling mod_rewrite
The mod_rewrite module uses a rule-based rewriting engine based on a PCRE regular-expression parser to rewrite requested URLs on the fly. By default, mod_rewrite maps a URL to a filesystem path. However, it can also be used to redirect one URL to another URL, or to invoke an internal proxy fetch.
For more information, visit http://httpd.apache.org/docs/current/mod/mod_rewrite.html
sudo a2enmod rewrite
sudo service apache2 restart
Deploying a New Site Folder Structure
By default the Web server is hosting the files in the location "/var/www", but for security reasons
and to avoid ownership problems, we are going to use another place to host our Website files.
Let's create a new folder to store the Web files and the log files of the site.
mkdir /home/youruser/lamp/
mkdir /home/youruser/lamp/public_html/
mkdir /home/youruser/lamp/logs/
NOTE: You can place your new site folders at any location; this is just an example. Replace "youruser" with an actual Linux username.
To store the Website files we are going to use the folder "public_html". For our log files, we are going to use the folder "logs".
sudo cp /etc/apache2/sites-available/000-default.conf /etc/apache2/sites-available/mydevsite.conf
NOTE: "mydevsite" is the name of the new site used in this example. You can use any other name you like.
sudo gedit /etc/apache2/sites-available/mydevsite.conf
<VirtualHost *:80>
# The ServerName directive sets the request scheme, hostname and port that
# the server uses to identify itself. This is used when creating
# redirection URLs. In the context of virtual hosts, the ServerName
# specifies what hostname must appear in the request's Host: header to
# match this virtual host. For the default virtual host (this file) this
# value is not decisive as it is used as a last resort host regardless.
# However, you must set it for any further virtual host explicitly.
#ServerName www.example.com
ServerAdmin webmaster@localhost
DocumentRoot /var/www/html
# Available loglevels: trace8, ..., trace1, debug, info, notice, warn,
# error, crit, alert, emerg.
# It is also possible to configure the loglevel for particular
# modules, e.g.
#LogLevel info ssl:warn
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
# For most configuration files from conf-available/, which are
# enabled or disabled at a global level, it is possible to
# include a line for only one particular virtual host. For example the
# following line enables the CGI configuration for this host only
# after it has been globally disabled with "a2disconf".
#Include conf-available/serve-cgi-bin.conf
</VirtualHost>
# vim: syntax=apache ts=4 sw=4 sts=4 sr noet
Make some modifications to make it look like this, or simply copy and paste it:
<VirtualHost *:80>
ServerAdmin webmaster@localhost
DocumentRoot /home/youruser/lamp/public_html
<Directory />
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
Allow from all
Require all granted
</Directory>
ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
<Directory "/usr/lib/cgi-bin">
AllowOverride All
Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
Order allow,deny
Allow from all
</Directory>
ErrorLog /home/youruser/lamp/logs/error.log
# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
LogLevel warn
CustomLog /home/youruser/lamp/logs/access.log combined
Alias /doc/ "/usr/share/doc/"
<Directory "/usr/share/doc/">
Options Indexes MultiViews FollowSymLinks
AllowOverride All
Order deny,allow
Deny from all
Allow from 127.0.0.0/255.0.0.0 ::1/128
</Directory>
</VirtualHost>
NOTE: Replace "youruser" with your current user name.
Save your changes.
Now we need to enable the site. In a terminal type:
sudo a2ensite mydevsite
Lets disable the default site, since we don't need it anymore.
sudo a2dissite 000-default
Restart Apache to complete the process. In a terminal type:
sudo service apache2 restart
To test out our new site, let's create a quick test file. In a terminal type:
echo "<?php echo 'Hello world, today is is: '.date('Y/m/d'); ?>" | tee /home/youruser/lamp/public_html/today.php
NOTE: Replace "yourname" with your current user name.
Open your browser and navigate to "localhost/today.php".
If everything is working okay, you should see something like this:
Hello world, today is is: 2012/05/05
Enabling Additional Ports
Note: If you have no plans to show your local site to another person over the Internet, skip this section.
With the last configuration you should be able to access your page and access it from another computer connected to your LAN. If your computer is connected to the Internet and also has an assigned Public IP, you can access your site using that IP from any Web browser. Note that some ISPs do not allow HTTP traffic (HTTP = port 80) over dynamic IP addresses. To solve this, you need to configure Apache to reply to requests from a different port. In this case we are going to use the port number 8080 which is easy to remember.
If you are using a router to connect to the Internet, you have to configure a port forwarding setting on your router to let other people see your local site. Google "how to do port forwarding" on your current router model. If you don't know the difference between a Static IP, Dynamic IP, Private IP and a Public IP, we recommend you to do a Wikipedia reading about these topics.
sudo gedit /etc/apache2/ports.conf
Find the line "listen 80" and insert this line underneath:
Listen 8080
SAVE
sudo gedit /etc/apache2/sites-available/mydevsite
Find this directive "<VirtualHost *:80>" and make the following modification:
<VirtualHost *:80 *:8080>
sudo service apache2 restart
To test your new configuration, try to access your site from another computer over Internet. Just type your IP in the browser's address bar and press enter. If the request fails, try the new alternative port like this: xxx.xxx.xxx.xxx:8080
Preventing Ownership and Permissions Problems
On Linux machines, file permissions are an important thing. Linux uses a mechanism to control what users can do and cannot do about folders, files and even the execution of applications. This mechanism consists of parameters, the ownership and the permissions.
Files and Folders Ownership
Ownership has two parameters: The owner and the group.
The "owner" is the user that owns the file or folder and is represented by a "username". In Linux persons, applications and services use usernames. On most Linux distributions, the Apache service runs under the username "www-data".
The "group" is used to associate users into an logical group. This figure is useful when an administrator needs to grant or deny permissions to several users with one single command and not user by user.
Files and Folders Permissions
The permissions have three parameters that represent file and folder permissions for the owner, the group and others. These number range from 0 to 7, and mean the following:
4 = permission to read
2 = permission to write
1 = permission to execute
0 = no permissions at all
Note: "Others" represents everybody. This parameter is used to grant permission to everyone no matter the user or the group they belong to. This parameter should be set with care under certain situations. Granting incorrect permissions to sensitive files and folders can cause security problems.
For example, if we have a file with permissions such as "644", it means (owner=read+write)(group=read)(others=read).
To get more information about the Linux file systems and file permissions
Adding Yourself to the Apache Group and Modifying Permissions
For this example, your username will be "youruser". On most Linux distributions, the Apache service runs on the user "www-data" and the group "www-data". We need to include our user "youruser" in the "www-data" group to be able to set permissions to the Web server files and have no problems when we have to edit them.
To add "youruser" to the Apache group, open a terminal and type:
sudo adduser youruser www-data
Now we need to change the owner and group of all our Web server files to owner "www-data" and group "www-data".
sudo chown -R www-data:www-data /home/youruser/lamp/public_html
Finally, we have to set the correct folder permission so both Apache and our user can edit the files with no problems. On a terminal type:
sudo chmod -R 775 /home/youruser/lamp/public_html
Common Problems and Confusions
When Joomla creates files on extension installations or any other operation, it uses the default mask 755 for folders and 644 for files. These permissions are correct and secure for production servers but it will give us problems on our local server because our editor will not be able to edit those files and folders. To fix these problems, simply run again this command:
sudo chmod -R 775 /home/youruser/lamp/public_html
In the case you manually move files from your personal folders to the server Web folder "public_html" those new files most likely will be owned by your username. This can cause problems if the server needs to modify or delete information. To prevent this problem, every time you move or copy information to your server Web folder you have to set the correct owner and group permissions for all those new files. Open a terminal and run this command:
sudo chown -R www-data:www-data /home/youruser/lamp/public_html
Note: If your server has too many files, these commands could be slow but you can always set a more specific path to apply permission in fewer files.
An other option is to configure the default Apache owner and group. For all new files created by the server these settings are used. We can change the in the environment variables file. Run this command to open and edit the file:
sudo gedit /etc/apache2/envvars
Find the following lines and change them this way (replace "youruser" with your current username):
export APACHE_RUN_USER=youruser
export APACHE_RUN_GROUP=www-data
Restart apache with the following command:
sudo service apache2 restart
Other Configurations
Open a terminal and type:
sudo gedit /etc/php5/apache2/php.ini
Find the line:
output_buffering =
Set the value to "= Off".
Find the line:
post_max_size =
Set the value to "= 20M".
Find the line:
upload_max_filesize =
Set the value to "= 20M".
Save the changes.
Type in your terminal:
sudo service apache2 restart
Enforcing Security
Since your computer is now running Web services, these services are listening for requests and will reply to anyone who has the correct IP and port. In other words, other people in your LAN and Internet can access your local site without your permission or they can even try to crack or hack your workstation. To prevent this, you need to install a firewall and "deny" by default any external incoming requests to your computer.
For Linux users, there is a nice and simple firewall called "Uncomplicated Firewall". To install the user interface and manage the firewall from your desktop, just follow these steps:
Open a terminal and type:
sudo apt-get install gufw
Note: You can also install the application from the Software Manager.
Open the application. When the installation finishes, press the "unlock" button and type your administrative password.
Set "Status = On" and "Incoming = Deny". Leave the rest of the settings at their default values.
To test your firewall, just try to connect to your local site from a local computer on your LAN or a remote computer over the Internet. When the firewall status is "Status = On", you shouldn't be able to connect at all.
Now temporarily change the status of your firewall to "Status = Off" and try to connect again. People should be able to see your local site just fine. Remember to set "Status = On" after this test.
Note: In this tutorial we are denying any incoming external requests to any port. As a side note, you can also Deny all incoming requests and manually allow incoming requests to few specific ports if you wish, but those kinds of settings are up to you. Since a PC workstation is not a server, it is okay to deny all incoming traffic by default.
https://jagowebdev.com/install-xampp-lebih-dari-satu-di-satu-komputer/
https://jagowebdev.com/install-xampp-lebih-dari-satu-di-satu-komputer/
---------------------------
CENTOS .......
https://www.dewaweb.com/blog/cara-install-lamp-stack-di-centos-7/
Sebelum memulainya, perlu instalasi Firewall supaya lebih secure.
Pada Firewall ini menggunakan CSF (ConfigServer Security & Firewall).
Sekilas Tentang CSF
CSF adalah Stateful Packet Ispection Firewall, Login dan Intrusion Detection & Security Application
untuk Linux Server.
cd /usr/src
wget https://download.configserver.com/csf.tgz
tar -xzf csf.tgz
cd csf
sh install.sh
nano /etc/csf/csf.conf
csf -r *RESTART ...
Berikut ini cara install LAMP Stack di CentOS 7:
Step 1 – Add Repository
Login sebagai root dan add repository EPEL dengan command di bawah ini:
rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY*
yum install epel-release -y
yum install mariadb-server mariadb -y
systemctl start mariadb.service
systemctl enable mariadb.service
mysql_secure_installation
Enter current password for root (enter for none): <= [ENTER]
OK, successfully used password, moving on...
Set root password? [Y/n] y
New password: <= [Masukan Password root MySQL]
Re-enter new password: <= [Masukan Password root MySQL]
Password updated successfully!
Reloading privilege tables..
... Success!
Remove anonymous users? [Y/n] y
... Success!
Disallow root login remotely? [Y/n] y
... Succes!
Remove test database and access to it? [Y/n] y
- Dropping test database...
... Success!
- Removing privileges on test database...
... Success!
Reload privilege tables now? [Y/n] y
... Success!
All done! If you've completed all of the above steps, your MariaDB
installation should now be secure.
Install web server Apache sesuai dengan LAMP Stack. Untuk saat ini Apache versi terbaru adalah 2.4.
Start dan enable Apache untuk start on-boot.
yum install httpd -y
systemctl start httpd
systemctl enable httpd
Lakukan instalasi PHP untuk memproses script website untuk ditampilkan menjadi sebuah konten.
Tambahkan Remi CentOS Repository.
rpm -Uvh http://rpms.remirepo.net/enterprise/remi-release-7.rpm
yum install yum-utils -y
yum update -y
yum-config-manager --enable remi-php70
yum install php php-opcache -y
systemctl restart httpd.service ** Restart Apache untuk memperbaharui perubahan.
https://www.dewaweb.com/blog/cara-install-lamp-stack-di-centos-7/
https://www.dewaweb.com/blog/cara-instalasi-lamp-stack-di-centos-8/
Control panel tak selalu perlu digunakan untuk mengelola website pribadi di VPS atau cloud server, hal ini dapat dilakukan jika kamu sudah memiliki pengalaman pada Linux atau menjadi system administrator, karena nantinya akan penuh dengan CLI (Command Line Interface) tidak ada GUI seperti cPanel atau CWP pada umumnya. Pada artikel ini kami akan membahas mengenai cara instalasi LAMP Stack di CentOS 8.
DNF atau Dandified YUM merupakan generasi terbaru dari package manager untuk distribusi berbasis .rpm yang dirilis pada 2018. Pada command atau perintah di CentOS 8 ini, kita akan lebih banyak menggunakan DNF.
Sebelum mulai mempraktikkan cara instalasi LEMP Stack, pastikan kamu sudah memenuhi beberapa persyaratan berikut:
VPS dengan OS CentOS 8.
Domain yang sudah diarahkan ke alamat IP VPS. (Dewaweb juga menyediakan hosting murah gratis domain)
Akses root.
Update Packages CentOS 8
Kamu perlu melakukan update package pada CentOS 8 terlebih dulu menggunakan perintah DNF, kemudian reboot server.
dnf update
reboot
dnf install httpd httpd-tools -y
systemctl enable httpd
systemctl start httpd
systemctl status httpd
Setelah instalasi web server, untuk mendapatkan versi terbaru dari Apache,
kamu bisa menggunakan command di bawah ini:
rpm -qi httpd
Name : httpd
Version : 2.4.37
Release : 16.module_el8.1.0+256+ae790463
Architecture: x86_64
Install Date: Thu 21 May 2020 06:44:49 AM UTC
Group : System Environment/Daemons
Size : 5611291
License : ASL 2.0
Signature : RSA/SHA256, Mon 23 Dec 2019 10:22:02 PM UTC, Key ID 05b555b38483c65d
Source RPM : httpd-2.4.37-16.module_el8.1.0+256+ae790463.src.rpm
Build Date : Mon 23 Dec 2019 08:46:30 PM UTC
Build Host : x86-02.mbox.centos.org
Relocations : (not relocatable)
Packager : CentOS Buildsys <[email protected]>
Vendor : CentOS
URL : https://httpd.apache.org/
Summary : Apache HTTP Server
Description :
The Apache HTTP Server is a powerful, efficient, and extensible
web server.
Di sini kami menggunakan MariaDB sebagai Database di LAMP Stack ini, karena MySQL saat ini sudah deprecated alias tidak up-to-date.
dnf install mariadb-server mariadb -y
systemctl start mariadb
systemctl enable mariadb
systemctl status mariadb
Kemudian, ketikan perintah atau command di bawah ini untuk mulai inisialisasi MariaDB.
mysql_secure_installation
Enter current password for root (enter for none):
OK, successfully used password, moving on…
Set root password? [Y/n] y
New password:
Re-enter new password:
Password updated successfully!
Reloading privilege tables..
… Success!
Remove anonymous users? [Y/n] y
… Success!
Disallow root login remotely? [Y/n] y
… Success!
Remove test database and access to it? [Y/n] y
– Dropping test database…
… Success!
– Removing privileges on test database…
… Success!
Reload privilege tables now? [Y/n] y
… Success!
Cleaning up…
All done! If you’ve completed all of the above steps, your MariaDB
installation should now be secure.
sudo dnf install https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm
Install EPEL Repository
dnf install https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm
Install YUM-Utils
dnf install dnf-utils http://rpms.remirepo.net/enterprise/remi-release-8.rpm
Gunakan command di bawah ini untuk melihat PHP module yang tersedia untuk diinstal.
dnf module list php
Remi’s Modular repository for Enterprise Linux 218 kB/s | 567 kB 00:02
Safe Remi’s RPM repository for Enterprise Linux 400 kB/s | 1.5 MB 00:03
Last metadata expiration check: 0:00:01 ago on Thu 21 May 2020 06:52:37 AM UTC.
CentOS-8 – AppStream
Name Stream Profiles Summary
php 7.2 [d] common [d], devel, minimal PHP scripting language
php 7.3 common, devel, minimal PHP scripting language
Remi’s Modular repository for Enterprise Linux 8 – x86_64
Name Stream Profiles Summary
php remi-7.2 common [d], devel, minimal PHP scripting language
php remi-7.3 common [d], devel, minimal PHP scripting language
php remi-7.4 common [d], devel, minimal PHP scripting language
Hint: [d]efault, [e]nabled, [x]disabled, [i]nstalled
Dari output di atas, PHP versi 7.4 adalah versi terbaru yang akan digunakan sebagai bagian
rangkaian cara instalasi LAMP Stack berikut, tapi kamu perlu melakukan reset PHP module
terlebih dulu dengan memasukkan command di bawah ini.
dnf module reset php
Kemudian enable module php versi 7.4 yang terbaru atau up-to-date.
$ dnf module enable php:remi-7.4
Dependencies resolved.
dnf install php php-opcache php-gd php-curl php-mysqlnd
php -v
systemctl enable php-fpm
systemctl start php-fpm
systemctl status php-fpm
Pada SELinux, untuk mengizinkan Apache untuk mengeksekusi php via php-fpm, perlu seperti di bawah ini.
setsebool -P httpd_execmem 1
systemctl restart httpd
https://www.labanapost.com/2008/11/linux/instalasi-lampp-cara-saya/
http://www.labanapost.com/2008/09/linux/bagi-bagi-partisi-di-linux/
http://www.labanapost.com/2008/09/linux/bagi-bagi-partisi-di-linux/
====================
https://www.niagahoster.co.id/blog/cara-install-wordpress/
mysql -uroot -p
Create Database:
CREATE DATABASE wordpresslamp CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci;
Create User Database dan Grant Permissionsnya.
GRANT ALL ON wordpresslamp.* TO 'dewauser'@'localhost' IDENTIFIED BY 'dewawebwp123';
Flush Privileges untuk reload perubahan dan keluar dari MySQL.
FLUSH PRIVILEGES;
EXIT;
cd /tmp
wget https://wordpress.org/latest.tar.gz
tar -xzf latest.tar.gz
cp /tmp/wordpress/wp-config-sample.php /tmp/wordpress/wp-config.php
cd /var/www/html/
mkdir lamp.dewiweb.net
chown -R apache:apache /var/www/html/lamp.dewiweb.net/
sudo cp -a /tmp/wordpress/. /var/www/html/lamp.dewiweb.net/
Generate secret salt secret key WordPress.
curl -s https://api.wordpress.org/secret-key/1.1/salt/
Key yang digenerate akan seperti dibawah ini.
define('AUTH_KEY','>i{2HZWW%#@[ejU_:@IQ,j*]B!~Hf`(gw7Mfk_+%@HoV8oo@=]+8X{8*dh>VTFB]');
define('SECURE_AUTH_KEY', '_uVe4X.-%c)ob^cWDxItqwa,J*,z]N4{N5!WOOMXl>JUqn|!JyOw7?&?2SQZM|3+');
define('LOGGED_IN_KEY', 'P~kb+.lQS./gA-L.E8+a>YZKN{zQ|*$8CKzwZ;bB~>gYuP5l Aa;OWrZ<N)iX<nW');
define('NONCE_KEY', '5Pl4 %AdlqowfwE;|m!z?S~ 6^8L7+vY]M=hb3a7^C>?2C`fz+u|H[F!Jf!b/uAE');
define('AUTH_SALT', 'IiI<>I<Lu)K6FaaB@OVd+a:Ao@`tbR1Hhb}a,M+4A0BG}hH$I.Qyd{x~BP4?ww( ');
define('SECURE_AUTH_SALT', 'c%G+Z|_{9i6|x4:6#up}S}SCIW;I2:c^-dtM<<DwZ`kE4)X=!XSRIid&`3cj4DCy');
define('LOGGED_IN_SALT', 'W>XGF~*uk[mA<VgO6+{FI,W,oCzp(K`r3-#3Q#0I*A1gHUoM-D|>7P4>]R+..~^K');
define('NONCE_SALT', '8NRqc!14jFBWw`:q}?NwM0h_r}@`7z^HM!A%j_VvlhcwOJ-J`#YIaBV6@9mO%| I');
/** The name of the database for WordPress */
define( 'DB_NAME', 'wordpresslamp' );
/** MySQL database username */
define( 'DB_USER', 'dewauser' );
/** MySQL database password */
define( 'DB_PASSWORD', 'dewawebwp123' );
/** MySQL hostname */
define( 'DB_HOST', 'localhost' );
Save dan exit.
yum install git -y
cd /opt
git clone https://github.com/letsencrypt/letsencrypt
service httpd stop
./letsencrypt/letsencrypt-auto certonly --standalone
Ikuti intruksi seperti di bawah ini.
Enter email address (used for urgent renewal and security notices) (Enter 'c' to
cancel): [email protected]
Please enter in your domain name(s) (comma and/or space separated) (Enter 'c'
to cancel): lamp.dewiweb.net
Certificate dan Chainnya disimpan pada:
/etc/letsencrypt/live/lamp.dewiweb.net/fullchain.pem
Private Key disimpan pada:
/etc/letsencrypt/live/lamp.dewiweb.net/privkey.pem
nano /etc/httpd/conf.d/example.com.conf
<VirtualHost *:80>
ServerName lamp.dewiweb.net
ServerAlias www.lamp.dewiweb.net
Redirect permanent / https://lamp.dewiweb.net/
</VirtualHost>
<VirtualHost *:443>
ServerName lamp.dewiweb.net
ServerAlias www.lamp.dewiweb.net
<If "%{HTTP_HOST} == 'www.lamp.dewiweb.net'">
Redirect permanent / https://lamp.dewiweb.net/
</If>
DirectoryIndex index.html index.php
DocumentRoot /var/www/html/lamp.dewiweb.net
ErrorLog /var/log/httpd/lamp.dewiweb.net-error.log
CustomLog /var/log/httpd/lamp.dewiweb.net-access.log combined
SSLEngine On
SSLCertificateFile /etc/letsencrypt/live/lamp.dewiweb.net/fullchain.pem
SSLCertificateKeyFile /etc/letsencrypt/live/lamp.dewiweb.net/privkey.pem
<Directory /var/www/html/lamp.dewiweb.net>
Options FollowSymLinks
AllowOverride All
Require all granted
</Directory>
</VirtualHost>
*save
systemctl start httpd
$ yum install php-fpm php-mysql php-mysqlnd php-pdo php-gd php-ldap php-odbc php-pear php-xml php-xmlrpc php-mbstring php-soap curl curl-devel -y
systemctl restart httpd
https://www.dewaweb.com/blog/cara-install-wordpress-dengan-lamp-stack/
https://www.dewaweb.com/blog/cara-install-lamp-stack-di-centos-7/
https://betterprogramming.pub/
https://www.dewaweb.com/blog/cara-mencegah-dan-mengatasi-serangan-di-wordpress/
https://www.hostinger.co.id/tutorial/install-lamp-ubuntu-16-04
adduser<username>
Kemudian buat sudoer untuk user yang baru saja dibuat.
usermod -aG sudo <username>
sudo su - <username>
sudo apt-get update
sudo apt-get upgrade
sudo apt-get install apache2
http://<your_vps_ip_address_here>
http://195.110.59.211
sudo apt-get install ufw
sudo ufw allow http
sudo ufw allow https
sudo systemctl status apache2
sudo apt-get install mysql-server
sudo systemct1 status mysql
sudo apt-get install php libapache2-mod-php php-mcrypt php-mysql php-cgi php-curl php-json
sudo apt-get install nano
sudo nano /var/www/html/test.php
Pada saat instalasi berlangsung, Anda akan diminta untuk memasukkan password user root.
Pastikan untuk memasukkan password yang kut. Anda harus mengisi kolom password.
Perintah di atas mengizinkan traffic HTTP dan HTTPS melewati firewall. UFW merupakan aplikasi baris perintah
yang disebut Uncomplicated Firewall. UFW digunakan untuk mengelola dan membuat rule untuk Linux firewall.
Masukkan alamat IP VPS Anda ke browser untuk mengecek instalasi. Anda dapat mengecek status server Apache
dengan perintah di bawah ini.
Catatan: Jika Anda tidak tahu alamat IP VPS Anda, maka cara tercepat untuk mengetahuinya adalah
dengan menjalankan perintah di bawah ini. Perintah ini akan menampilkan alamat IP publik dari VPS Anda.
dig +short myip.opendns.com @resolver1.opendns.com
https://www.niagahoster.co.id/blog/cara-install-lamp-ubuntu/
Akses server menggunakan SSH dengan menggunakan user root, kemudian tambahkan user baru pada server tersebut.
$ adduser<username>
Perintah ini digunakan untuk menambahkan user baru. Agar mempunyai akses super user, maka user yang baru saja dibuat ditambahkan pada sudoers. Sudoers merupakan daftar yang digunakan untuk mencatat user apa saja yang mempunyai akses sampai ke root.
$ usermod -aG sudo <username>
Setelah proses penambahan user baru selesai maka terbentuk user baru di server, putuskan
koneksi SSH kemudian lakukan akses SSH kembali dengan user yang telah dibuat. Atau, jika
tidak ingin memutuskan koneksi dapat langsung masuk ke user baru. Caranya dengan
mengetikkan sudo su <username> pada teks perintah.
sudo apt-get update
sudo apt-get install apache2
http://<your_vps_ip_address_here>
http://10.11.12.13
sudo apt-get install ufw
sudo ufw allow http
sudo ufw allow https
sudo systemctl status apache2
sudo apt-get install mysql-server
sudo systemctl status mysql
sudo apt-get install php libapache2-mod-php php-mcrypt php-mysql php-cgi php-curl php-json
cd /var/www/html/
https://upcloud.com/community/tutorials/installing-lamp-stack-ubuntu/
sudo apt update
sudo apt upgrade
Now open ports 22 (for SSH), 80 and 443 and enable Ubuntu Firewall (ufw):
sudo ufw allow ssh
sudo ufw allow 80
sudo ufw allow 443
sudo ufw enable
sudo apt install apache2
sudo systemctl status apache2
http://YOURSERVERIPADDRESS/
sudo apt install php7.4 php7.4-mysql php-common php7.4-cli php7.4-json php7.4-common php7.4-opcache libapache2-mod-php7.4
php --version
sudo systemctl restart apache2
echo '<?php phpinfo(); ?>' | sudo tee -a /var/www/html/phpinfo.php > /dev/null
http://YOURSERVERIPADDRESS/phpinfo.php
sudo rm /var/www/html/phpinfo.php
sudo apt install mariadb-server mariadb-client
sudo systemctl status mariadb
sudo mysql_secure_installation *manual inputan .... Y
As you have no root password set for MariaDB you should simply press Enter when prompted, pressing Y on the next question to then set a root password (keep this safe and secure!) With that set, you can press Enter for the remaining questions as the defaults for each of these will help to secure your new installation.
https://betterprogramming.pub/how-to-install-lamp-stack-on-ubuntu-db77ac018116
sudo apt-get update
sudo apt-get install mysql-server mysql-client libmysqlclient-dev
sudo apt-get install apache2 apache2-doc apache2-npm-prefork apache2-utils libexpat1 ssl-cert
sudo apt-get install libapache2-mod-php7.0 php7.0 php7.0-common php7.0-curl php7.0-dev php7.0-gd php-pear php-imagick php7.0-mcrypt php7.0-mysql php7.0-ps php7.0-xsl
sudo apt-get install phpmyadmin
https://phoenixnap.com/kb/how-to-install-lamp-stack-on-ubuntu
sudo apt-get update
sudo apt-get install apache2
sudo service apache2 status
sudo ufw app list
sudo ufw app info “Apache Full”
sudo apt-get install curl
curl http://icanhazip.com
sudo apt-get install mysql-server
sudo apt-get install php libapache2-mod-php php-mysql
sudo nano /etc/apache2/mods-enabled/dir.conf *to move index html to index php
sudo systemctl restart apache2
apt-cache search php- | less
apt-cache show php-cli *For example, to find out what the module php-cli does, type:
sudo apt-get install php-cli
sudo nano /var/www/html/info.php
https://www.digitalocean.com/community/tutorials/how-to-install-linux-apache-mysql-php-lamp-stack-ubuntu-18-04
$ sudo a2enmod php7.2
Considering dependency mpm_prefork for php7.2:
Considering conflict mpm_event for mpm_prefork:
Considering conflict mpm_worker for mpm_prefork:
Module mpm_prefork already enabled
Considering conflict php5 for php7.2:
Enabling module php7.2.
To activate the new configuration, you need to run:
systemctl restart apache2
$ sudo systemctl restart apache2
https://sekolahkoding.com/forum/membuat-virtual-host-di-web-server-apache-linux-ubuntukali-linux-dll
mkdir /var/www/html/domainku.bro
cd /etc/apache2/sites-available/
sudo cp 000-default.conf domainku-bro.conf
sudo nano domainku-bro.conf
<VirtualHost *:80>
#ServerName www.example.com
ServerAdmin webmaster@localhost
DocumentRoot /var/www/html
#LogLevel info ssl:warn
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
#Include conf-available/serve-cgi-bin.conf
</VirtualHost>
ubah bagian www.example.com menjadi nama domain yang ingin dibuat misal menjadi domainku.bro, jangan lupa hilangkan tanda # di belakangnya dan bagian /var/www/html menjadi lokasi yang sudah kita buat di step 1 tadi. untuk yang lainnya biarkan default saja, kurang lebih akan jadi seperti ini
<VirtualHost *:80>
ServerName domainku.bro
ServerAdmin webmaster@localhost
DocumentRoot /var/www/html/domainku.bro
#LogLevel info ssl:warn
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
#Include conf-available/serve-cgi-bin.conf
</VirtualHost>
sudo a2ensite domainku.bro
sudo nano /etc/hosts
127.0.0.1 domainku.bro
sudo service apache2 reload
https://www.digitalocean.com/community/tutorials/how-to-install-linux-apache-mariadb-php-lamp-stack-on-debian-10
on DEBIAN 10
sudo apt update
sudo apt install apache2
sudo ufw app list
The WWW profiles are used to manage ports used by web servers:
Output
Available applications:
. . .
WWW
WWW Cache
WWW Full
WWW Secure
sudo ufw app info "WWW Full"
Output
Profile: WWW Full
Title: Web Server (HTTP,HTTPS)
Description: Web Server (HTTP,HTTPS)
Ports:
80,443/tcp
sudo ufw allow in "WWW Full"
http://your_server_ip
sudo apt install mariadb-server
sudo mysql_secure_installation
sudo mariadb
CREATE DATABASE example_database;
GRANT ALL ON example_database.* TO 'example_user'@'localhost' IDENTIFIED BY 'password' WITH GRANT OPTION;
FLUSH PRIVILEGES;
exit
mariadb -u example_user -p
SHOW DATABASES;
sudo apt install php libapache2-mod-php php-mysql
This should install PHP without any problems. We’ll test this in a moment.
sudo nano /etc/apache2/mods-enabled/dir.conf
<IfModule mod_dir.c>
DirectoryIndex index.html index.cgi index.pl index.php index.xhtml index.htm
</IfModule>
Move like ...
<IfModule mod_dir.c>
DirectoryIndex index.php index.html index.cgi index.pl index.xhtml index.htm
</IfModule>
sudo systemctl reload apache2
sudo systemctl status apache2
create vhost
sudo mkdir /var/www/your_domain
sudo chown -R $USER:$USER /var/www/your_domain
sudo nano /etc/apache2/sites-available/your_domain.conf
<VirtualHost *:80>
ServerName your_domain
ServerAlias www.your_domain
ServerAdmin webmaster@localhost
DocumentRoot /var/www/your_domain
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
With this VirtualHost configuration, we’re telling Apache to serve your_domain using /var/www/your_domain
as the web root directory. If you’d like to test Apache without a domain name, you can remove or comment
out the options ServerName and ServerAlias by adding a # character in the beginning of each option’s lines.
You can now use a2ensite to enable this virtual host:
sudo a2ensite your_domain
sudo a2dissite 000-default
sudo apache2ctl configtest
sudo systemctl reload apache2
nano /var/www/your_domain/info.php
http://your_domain/info.php
mariadb -u example_user -p
CREATE TABLE example_database.todo_list (
item_id INT AUTO_INCREMENT,
content VARCHAR(255),
PRIMARY KEY(item_id)
);
INSERT INTO example_database.todo_list (content) VALUES ("My first important item");
SELECT * FROM example_database.todo_list;
nano /var/www/your_domain/todo_list.php
<?php
$user = "example_user";
$password = "password";
$database = "example_database";
$table = "todo_list";
try {
$db = new PDO("mysql:host=localhost;dbname=$database", $user, $password);
echo "<h2>TODO</h2><ol>";
foreach($db->query("SELECT content FROM $table") as $row) {
echo "<li>" . $row['content'] . "</li>";
}
echo "</ol>";
} catch (PDOException $e) {
print "Error!: " . $e->getMessage() . "<br/>";
die();
}
http://your_domain/todo_list.php
https://www.gnome-look.org/browse/ord/rating
https://pkgs.org/download/net-tools
https://media.neliti.com/media/publications/174408-ID-remastering-distro-ubuntu-untuk-menunjan.pdf
https://www.cacti.net/downloads
http://www.sugengsiswanto.com/2015/01/install-remastersys-untuk-remastering-ubuntu-linux.html
https://docplayer.info/185764-Cara-cepat-mudah-remastering-ubuntu-menggunakan-remastersys-source-situs-resmi-how-to-remastersys.html
https://docplayer.info/185764-Cara-cepat-mudah-remastering-ubuntu-menggunakan-remastersys-source-situs-resmi-how-to-remastersys.html
https://id.wikipedia.org/wiki/Daftar_rilis_Ubuntu
https://darmakusumandaru.blogspot.com/2016/06/tutorial-remastering-linux-ubuntu-1404.html
https://langittutorial.blogspot.com/2017/12/cara-install-dan-menggunakan-respin-remastering-tool-ubuntu-16.html
https://www.gnome-look.org/p/1365372
https://docplayer.info/56989336-Remaster-distro-linux-ubuntu-lts-menggunakan-remastersys-tugas-akhir.html
https://tutorialkreasikotakpensildarikardus.blogspot.com/2019/11/koleksi-tutorial-remastering-ubuntu.html
http://blog.ub.ac.id/izuaf/2012/01/10/remastering-menggunakan-uck-ubuntu-customization-kit
https://issuu.com/arifinlperz/docs/buku_remaster_ubuntu
https://issuu.com/arifinlperz/docs/buku_remaster_ubuntu
https://www.indonesianbacktrack.or.id/forum/thread-5582.html
https://www.proweb.co.id/articles/virtualbox/networking-mode.html
https://www.pintarkomputer.com/virtualbox-cara-mudah-koneksikan-komputer-host-pc-asli-dengan-komputer-guest-virtua
https://www.ayies.com/membuat-virtualbox-2-ethernet-dengan-ip-public-internet-dan-ip-private-lokal-akses-dari-host
======================================