เข้าถึง Matomo
- เปิดเว็บเบราว์เซอร์และไปที่:
http://<SERVER-IP> - ทำตาม setup wizard ของ Matomo เพื่อให้การติดตั้งเสร็จสมบูรณ์
ไฟล์และไดเรกทอรีสำคัญ
- เว็บรูท:
/var/www/matomo(เป็นเจ้าของโดยwww-data:www-data) - การกำหนดค่า Apache:
/etc/apache2/sites-available/matomo.conf - บันทึก:
/var/log/apache2/matomo_error.log&/var/log/apache2/matomo_access.log - ข้อมูลประจำตัวฐานข้อมูล:
/root/.cloudzy-creds
ตั้งค่าฐานข้อมูล
ระหว่าง setup ให้กรอก credentials ต่อไปนี้จากไฟล์ที่สร้างขึ้น (/root/.cloudzy-creds):
- Database Server:
เซิร์ฟเวอร์ฐานข้อมูล:
127.0.0.1 - เข้าสู่ระบบ:
matomo - Password: สุ่มสร้างอัตโนมัติ
- ชื่อฐานข้อมูล:
matomo
การจัดการ Apache
จัดการ service ของ Apache ด้วยคำสั่ง systemd:
systemctl status apache2
systemctl restart apache2
systemctl stop apache2
systemctl start apache2
เปิดใช้งาน SSL พร้อมโดเมน
1. ชี้โดเมนของคุณไปที่ IP ของเซิร์ฟเวอร์
2. แก้ไข config ของ Apache และแทนที่ ServerName <IP> ด้วยโดเมนของคุณ (ServerName <your-domain>):
vim /etc/apache2/sites-available/matomo.conf
3. ติดตั้ง Certbot:
apt install -y certbot python3-certbot-apache
4. รันคำสั่งต่อไปนี้เพื่อสร้างใบรับรอง Lets Encrypt ที่ถูกต้อง:
certbot --apache --non-interactive --agree-tos --email [email protected] -d yourdomain.com
5. รีสตาร์ท Apache เพื่อใช้การเปลี่ยนแปลง:
systemctl restart apache2
6. แก้ไขไฟล์ configuration ของ Matomo (/var/www/matomo/config/config.ini.php) และอัปเดต trusted_hosts ตั้งค่าด้านล่าง [General] ให้ใส่ domain ของคุณแทน IP:
[General]
trusted_hosts[] = "yourdomain.com"
7. เปิดเบราว์เซอร์และไปที่: https://yourdomain.com