ติดตั้ง Nginx + MySQL + PHPMyAdmin บน Ubuntu Server 24.04
sudo apt update && sudo apt upgrade -y
sudo apt install nginx -y sudo systemctl enable nginx sudo systemctl start nginx
sudo apt install mysql-server -y sudo systemctl enable mysql sudo systemctl start mysql
ตั้งค่าความปลอดภัย
sudo mysql_secure_installation
sudo mysql
CREATE USER 'admin'@'localhost' IDENTIFIED BY '12345678'; GRANT ALL PRIVILEGES ON *.* TO 'admin'@'localhost' WITH GRANT OPTION; FLUSH PRIVILEGES; EXIT;
sudo apt install php-fpm php-mysql -y
sudo nano /etc/nginx/sites-available/default
เพิ่มส่วนนี้หรือแก้ไขส่วนี้โดยการเปิด:
location ~ \.php$ {
include snippets/fastcgi-php.conf;
fastcgi_pass unix:/run/php/php8.3-fpm.sock;
}
Restart
sudo systemctl restart nginx
sudo apt install phpmyadmin -y
sudo ln -s /usr/share/phpmyadmin /var/www/html/phpmyadmin
เลือก Web Server → Nginx (manual config)
http://SERVER-IP
phpMyAdmin
http://SERVER-IP/phpmyadmin
user: admin password:12345678
ระบบสามารถรัน: