1. Update Software Package
sudo apt update
sudo apt upgrade
2. Install Apache Web Server
sudo apt install -y apache2 apache2-utils
Periksa status Service Apache
systemctl status apache2
Contoh Output:
* apache2.service - The Apache HTTP Server
Loaded: loaded (/lib/systemd/system/apache2.service; enabled; vendor prese>
Active: active (running) since Mon 2021-03-01 02:05:04 UTC; 18s ago
Docs: https://httpd.apache.org/docs/2.4/
Main PID: 15430 (apache2)
Tasks: 27 (limit: 4915)
Memory: 4.3M
CGroup: /system.slice/apache2.service
|-15430 /usr/sbin/apache2 -k start
|-15433 /usr/sbin/apache2 -k start
`-15434 /usr/sbin/apache2 -k start
Jika service belum running, jalankan dengan perintah:
sudo systemctl start apache2
Buat agar Apache dijalankan pada saat Server dinyalakan (Boot):
sudo systemctl enable apache2 Cek versi Apache:
apache2 -v
Server version: Apache/2.4.41 (Ubuntu)
Server built: 2020-08-12T19:46:17Jika Connection Refused:
sudo iptables -I INPUT -p tcp --dport 80 -j ACCEPT Atau
sudo ufw allow http
Atau bila diperlukan, matikan firewall
systemctl stop ufw
Set kepemilikan direktori web root (www-data) yang secara default merupakan kepemilikan user root, dirubah menjadi kepemilikan user apache:
sudo chown www-data:www-data /var/www/html/ -R
Periksa konfigurasi apache:
sudo apache2ctl -t
Jika ada error seperti ini:
AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.0.1. Set the 'ServerName' directive globally to suppress this message
Buat file konfigurasi dengan perintah ini:
sudo nano /etc/apache2/conf-available/servername.conf
Tambahkan pada file tersebut, parameter:
ServerName localhost
Lalu Enable file konfigurasi tersebut:
sudo a2enconf servername.conf
Restart / Reload apache:
sudo systemctl reload apache2
Periksa kembali konfigurasi apache:
sudo apache2ctl -t
Seharusnya sudah tidak ada error lagi.
Akses server dari jaringan lokal ke url: http://ip-server-anda/

0 komentar:
Posting Komentar