{"id":40233,"date":"2026-03-14T16:17:33","date_gmt":"2026-03-14T09:17:33","guid":{"rendered":"https:\/\/interdata.vn\/blog\/?p=40233"},"modified":"2026-05-05T15:43:04","modified_gmt":"2026-05-05T08:43:04","slug":"cai-dat-nginx-php-mysql-tren-ubuntu-vps","status":"publish","type":"post","link":"https:\/\/interdata.vn\/blog\/cai-dat-nginx-php-mysql-tren-ubuntu-vps\/","title":{"rendered":"C\u00e1ch C\u00e0i \u0110\u1eb7t Nginx + PHP + MySQL (LEMP Stack) Tr\u00ean Ubuntu VPS [2026]"},"content":{"rendered":"<div id=\"ez-toc-container\" class=\"ez-toc-v2_0_85 counter-hierarchy ez-toc-counter ez-toc-white ez-toc-container-direction\">\n<div class=\"ez-toc-title-container\">\n<p class=\"ez-toc-title\" style=\"cursor:inherit\">N\u1ed8I DUNG<\/p>\n<span class=\"ez-toc-title-toggle\"><a href=\"#\" class=\"ez-toc-pull-right ez-toc-btn ez-toc-btn-xs ez-toc-btn-default ez-toc-toggle\" aria-label=\"Toggle Table of Content\"><span class=\"ez-toc-js-icon-con\"><span class=\"\"><span class=\"eztoc-hide\" style=\"display:none;\">Toggle<\/span><span class=\"ez-toc-icon-toggle-span\"><svg style=\"fill: #999;color:#999\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" class=\"list-377408\" width=\"20px\" height=\"20px\" viewBox=\"0 0 24 24\" fill=\"none\"><path d=\"M6 6H4v2h2V6zm14 0H8v2h12V6zM4 11h2v2H4v-2zm16 0H8v2h12v-2zM4 16h2v2H4v-2zm16 0H8v2h12v-2z\" fill=\"currentColor\"><\/path><\/svg><svg style=\"fill: #999;color:#999\" class=\"arrow-unsorted-368013\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"10px\" height=\"10px\" viewBox=\"0 0 24 24\" version=\"1.2\" baseProfile=\"tiny\"><path d=\"M18.2 9.3l-6.2-6.3-6.2 6.3c-.2.2-.3.4-.3.7s.1.5.3.7c.2.2.4.3.7.3h11c.3 0 .5-.1.7-.3.2-.2.3-.5.3-.7s-.1-.5-.3-.7zM5.8 14.7l6.2 6.3 6.2-6.3c.2-.2.3-.5.3-.7s-.1-.5-.3-.7c-.2-.2-.4-.3-.7-.3h-11c-.3 0-.5.1-.7.3-.2.2-.3.5-.3.7s.1.5.3.7z\"\/><\/svg><\/span><\/span><\/span><\/a><\/span><\/div>\n<nav><ul class='ez-toc-list ez-toc-list-level-1 eztoc-toggle-hide-by-default' ><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-1\" href=\"https:\/\/interdata.vn\/blog\/cai-dat-nginx-php-mysql-tren-ubuntu-vps\/#Yeu-Cau-Truoc-Khi-Bat-Dau\" >Y\u00eau C\u1ea7u Tr\u01b0\u1edbc Khi B\u1eaft \u0110\u1ea7u<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-2\" href=\"https:\/\/interdata.vn\/blog\/cai-dat-nginx-php-mysql-tren-ubuntu-vps\/#Cai-Nginx-Tren-Ubuntu-VPS\" >C\u00e0i Nginx Tr\u00ean Ubuntu VPS<\/a><ul class='ez-toc-list-level-3' ><li class='ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-3\" href=\"https:\/\/interdata.vn\/blog\/cai-dat-nginx-php-mysql-tren-ubuntu-vps\/#Tai-sao-chon-Nginx-thay-vi-Apache-cho-VPS\" >T\u1ea1i sao ch\u1ecdn Nginx thay v\u00ec Apache cho VPS?<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-4\" href=\"https:\/\/interdata.vn\/blog\/cai-dat-nginx-php-mysql-tren-ubuntu-vps\/#Cac-lenh-cai-Nginx-tren-Ubuntu-2204-2404\" >C\u00e1c l\u1ec7nh c\u00e0i Nginx tr\u00ean Ubuntu 22.04 \/ 24.04<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-5\" href=\"https:\/\/interdata.vn\/blog\/cai-dat-nginx-php-mysql-tren-ubuntu-vps\/#Lam-sao-biet-Nginx-da-chay-thanh-cong\" >L\u00e0m sao bi\u1ebft Nginx \u0111\u00e3 ch\u1ea1y th\u00e0nh c\u00f4ng?<\/a><\/li><\/ul><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-6\" href=\"https:\/\/interdata.vn\/blog\/cai-dat-nginx-php-mysql-tren-ubuntu-vps\/#Cai-PHP-FPM-Va-Cac-Extension-Can-Thiet\" >C\u00e0i PHP-FPM V\u00e0 C\u00e1c Extension C\u1ea7n Thi\u1ebft<\/a><ul class='ez-toc-list-level-3' ><li class='ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-7\" href=\"https:\/\/interdata.vn\/blog\/cai-dat-nginx-php-mysql-tren-ubuntu-vps\/#Nen-cai-PHP-version-nao-cho-Ubuntu-2204-2404\" >N\u00ean c\u00e0i PHP version n\u00e0o cho Ubuntu 22.04 \/ 24.04?<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-8\" href=\"https:\/\/interdata.vn\/blog\/cai-dat-nginx-php-mysql-tren-ubuntu-vps\/#Cac-lenh-cai-PHP-FPM-va-extension-pho-bien\" >C\u00e1c l\u1ec7nh c\u00e0i PHP-FPM v\u00e0 extension ph\u1ed5 bi\u1ebfn<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-9\" href=\"https:\/\/interdata.vn\/blog\/cai-dat-nginx-php-mysql-tren-ubuntu-vps\/#Cach-ket-noi-Nginx-voi-PHP-FPM-qua-server-block\" >C\u00e1ch k\u1ebft n\u1ed1i Nginx v\u1edbi PHP-FPM qua server block<\/a><\/li><\/ul><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-10\" href=\"https:\/\/interdata.vn\/blog\/cai-dat-nginx-php-mysql-tren-ubuntu-vps\/#Cai-MySQL-Tren-Ubuntu-VPS\" >C\u00e0i MySQL Tr\u00ean Ubuntu VPS<\/a><ul class='ez-toc-list-level-3' ><li class='ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-11\" href=\"https:\/\/interdata.vn\/blog\/cai-dat-nginx-php-mysql-tren-ubuntu-vps\/#Nen-chon-MySQL-hay-MariaDB-cho-VPS-Ubuntu\" >N\u00ean ch\u1ecdn MySQL hay MariaDB cho VPS Ubuntu?<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-12\" href=\"https:\/\/interdata.vn\/blog\/cai-dat-nginx-php-mysql-tren-ubuntu-vps\/#Cac-lenh-cai-MySQL-80-tren-Ubuntu\" >C\u00e1c l\u1ec7nh c\u00e0i MySQL 8.0 tr\u00ean Ubuntu<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-13\" href=\"https:\/\/interdata.vn\/blog\/cai-dat-nginx-php-mysql-tren-ubuntu-vps\/#Tao-database-va-user-MySQL-dau-tien-cho-ung-dung\" >T\u1ea1o database v\u00e0 user MySQL \u0111\u1ea7u ti\u00ean cho \u1ee9ng d\u1ee5ng<\/a><\/li><\/ul><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-14\" href=\"https:\/\/interdata.vn\/blog\/cai-dat-nginx-php-mysql-tren-ubuntu-vps\/#Kiem-Tra-Toan-Bo-LEMP-Stack-Hoat-Dong\" >Ki\u1ec3m Tra To\u00e0n B\u1ed9 LEMP Stack Ho\u1ea1t \u0110\u1ed9ng<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-15\" href=\"https:\/\/interdata.vn\/blog\/cai-dat-nginx-php-mysql-tren-ubuntu-vps\/#Xu-Ly-Loi-Thuong-Gap-Khi-Cai-LEMP-Stack\" >X\u1eed L\u00fd L\u1ed7i Th\u01b0\u1eddng G\u1eb7p Khi C\u00e0i LEMP Stack<\/a><ul class='ez-toc-list-level-3' ><li class='ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-16\" href=\"https:\/\/interdata.vn\/blog\/cai-dat-nginx-php-mysql-tren-ubuntu-vps\/#Tai-sao-truy-cap-IP-VPS-chi-thay-trang-trang-hoac-502-Bad-Gateway\" >T\u1ea1i sao truy c\u1eadp IP VPS ch\u1ec9 th\u1ea5y trang tr\u1eafng ho\u1eb7c 502 Bad Gateway?<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-17\" href=\"https:\/\/interdata.vn\/blog\/cai-dat-nginx-php-mysql-tren-ubuntu-vps\/#Tai-sao-MySQL-khong-cho-phep-dang-nhap-sau-khi-cai\" >T\u1ea1i sao MySQL kh\u00f4ng cho ph\u00e9p \u0111\u0103ng nh\u1eadp sau khi c\u00e0i?<\/a><\/li><\/ul><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-18\" href=\"https:\/\/interdata.vn\/blog\/cai-dat-nginx-php-mysql-tren-ubuntu-vps\/#Cau-Hoi-Thuong-Gap-Khi-Cai-LEMP-Stack-Tren-Ubuntu-VPS\" >C\u00e2u H\u1ecfi Th\u01b0\u1eddng G\u1eb7p Khi C\u00e0i LEMP Stack Tr\u00ean Ubuntu VPS<\/a><ul class='ez-toc-list-level-3' ><li class='ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-19\" href=\"https:\/\/interdata.vn\/blog\/cai-dat-nginx-php-mysql-tren-ubuntu-vps\/#Cai-LEMP-stack-tren-Ubuntu-2404-co-khac-Ubuntu-2204-khong\" >C\u00e0i LEMP stack tr\u00ean Ubuntu 24.04 c\u00f3 kh\u00e1c Ubuntu 22.04 kh\u00f4ng?<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-20\" href=\"https:\/\/interdata.vn\/blog\/cai-dat-nginx-php-mysql-tren-ubuntu-vps\/#Co-the-cai-nhieu-phien-ban-PHP-cung-luc-tren-mot-VPS-khong\" >C\u00f3 th\u1ec3 c\u00e0i nhi\u1ec1u phi\u00ean b\u1ea3n PHP c\u00f9ng l\u00fac tr\u00ean m\u1ed9t VPS kh\u00f4ng?<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-21\" href=\"https:\/\/interdata.vn\/blog\/cai-dat-nginx-php-mysql-tren-ubuntu-vps\/#Sau-khi-cai-LEMP-xong-buoc-tiep-theo-de-chay-WordPress-la-gi\" >Sau khi c\u00e0i LEMP xong, b\u01b0\u1edbc ti\u1ebfp theo \u0111\u1ec3 ch\u1ea1y WordPress l\u00e0 g\u00ec?<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-22\" href=\"https:\/\/interdata.vn\/blog\/cai-dat-nginx-php-mysql-tren-ubuntu-vps\/#Tai-sao-nen-dung-PHP-FPM-thay-vi-mod-php-cho-Nginx\" >T\u1ea1i sao n\u00ean d\u00f9ng PHP-FPM thay v\u00ec mod_php cho Nginx?<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-23\" href=\"https:\/\/interdata.vn\/blog\/cai-dat-nginx-php-mysql-tren-ubuntu-vps\/#Can-mo-port-nao-tren-ufw-firewall-sau-khi-cai-LEMP-stack\" >C\u1ea7n m\u1edf port n\u00e0o tr\u00ean ufw firewall sau khi c\u00e0i LEMP stack?<\/a><\/li><\/ul><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-24\" href=\"https:\/\/interdata.vn\/blog\/cai-dat-nginx-php-mysql-tren-ubuntu-vps\/#Ket-Luan\" >K\u1ebft Lu\u1eadn<\/a><\/li><\/ul><\/nav><\/div>\n<p><!-- OVERVIEW BLOCK --><\/p>\n<div class=\"summary\">\n<p><strong>T\u00f3m t\u1eaft nhanh:<\/strong> LEMP stack l\u00e0 b\u1ed9 ph\u1ea7n m\u1ec1m g\u1ed3m Linux, Nginx, MySQL (ho\u1eb7c MariaDB) v\u00e0 PHP \u2014 n\u1ec1n t\u1ea3ng \u0111\u1ec3 ch\u1ea1y website \u0111\u1ed9ng tr\u00ean VPS. \u0110\u1ec3 c\u00e0i LEMP stack tr\u00ean Ubuntu VPS, b\u1ea1n th\u1ef1c hi\u1ec7n l\u1ea7n l\u01b0\u1ee3t: <code>apt install nginx<\/code> \u2192 c\u00e0i PHP-FPM k\u00e8m extension c\u1ea7n thi\u1ebft \u2192 c\u00e0i MySQL ho\u1eb7c MariaDB \u2192 c\u1ea5u h\u00ecnh Nginx server block \u0111\u1ec3 x\u1eed l\u00fd file PHP qua FastCGI. V\u1edbi VPS c\u00f3 k\u1ebft n\u1ed1i internet \u1ed5n \u0111\u1ecbnh, to\u00e0n b\u1ed9 qu\u00e1 tr\u00ecnh m\u1ea5t kho\u1ea3ng 15\u201320 ph\u00fat.<\/p>\n<ul>\n<li>C\u00e0i \u0111\u00fang th\u1ee9 t\u1ef1: Nginx \u2192 PHP-FPM \u2192 MySQL \u2192 c\u1ea5u h\u00ecnh server block<\/li>\n<li>Sau m\u1ed7i b\u01b0\u1edbc c\u00e0i, d\u00f9ng <code>systemctl status<\/code> \u0111\u1ec3 verify service \u0111\u00e3 ch\u1ea1y \u2014 \u0111\u1eebng b\u1ecf qua b\u01b0\u1edbc n\u00e0y<\/li>\n<li>Ubuntu 22.04 LTS l\u00e0 b\u1ea3n khuy\u1ebfn ngh\u1ecb cho production 2025; Ubuntu 24.04 d\u00f9ng l\u1ec7nh g\u1ea7n nh\u01b0 t\u01b0\u01a1ng t\u1ef1<\/li>\n<li>MySQL 8.0 v\u00e0 MariaDB 10.x \u0111\u1ec1u t\u01b0\u01a1ng th\u00edch \u2014 MariaDB nh\u1eb9 h\u01a1n, MySQL c\u00f3 JSON support n\u00e2ng cao h\u01a1n<\/li>\n<li>M\u1edf port 80 v\u00e0 443 tr\u00ean ufw tr\u01b0\u1edbc khi test t\u1eeb tr\u00ecnh duy\u1ec7t, kh\u00f4ng th\u00ec s\u1ebd kh\u00f4ng truy c\u1eadp \u0111\u01b0\u1ee3c d\u00f9 c\u00e0i \u0111\u00fang<\/li>\n<\/ul>\n<\/div>\n<p><!-- INTRO HOOK --><\/p>\n<p>SSH v\u00e0o VPS l\u1ea7n \u0111\u1ea7u, m\u00e0n h\u00ecnh terminal tr\u1eafng tinh, con tr\u1ecf nh\u1ea5p nh\u00e1y \u2014 kh\u00f4ng bi\u1ebft g\u00f5 g\u00ec ti\u1ebfp theo. C\u1ea3m gi\u00e1c n\u00e0y kh\u00e1 quen v\u1edbi ng\u01b0\u1eddi m\u1edbi nh\u1eadn th\u00f4ng tin \u0111\u0103ng nh\u1eadp VPS l\u1ea7n \u0111\u1ea7u. B\u01b0\u1edbc ti\u1ebfp theo c\u1ea7n l\u00e0m l\u00e0 c\u00e0i LEMP stack: Nginx x\u1eed l\u00fd HTTP request, PHP-FPM ch\u1ea1y code PHP, MySQL ho\u1eb7c MariaDB l\u00e0m database.<\/p>\n<p>B\u00e0i n\u00e0y <a href=\"https:\/\/interdata.vn\/blog\/cai-dat-nginx-php-mysql-tren-ubuntu-vps\/\" target=\"_blank\" rel=\"noopener\"><strong>h\u01b0\u1edbng d\u1eabn c\u00e0i Nginx + PHP + MySQL (LEMP Stack) tr\u00ean Ubuntu VPS<\/strong><\/a> \u2014 t\u1eebng l\u1ec7nh theo th\u1ee9 t\u1ef1, c\u00f3 ki\u1ec3m tra sau m\u1ed7i b\u01b0\u1edbc, v\u00e0 x\u1eed l\u00fd 2 l\u1ed7i th\u01b0\u1eddng g\u1eb7p nh\u1ea5t khi m\u1edbi setup. Thao t\u00e1c n\u00e0y \u0111\u00f3ng vai tr\u00f2 c\u1ef1c k\u1ef3 quan tr\u1ecdng trong <a href=\"https:\/\/interdata.vn\/blog\/cau-hinh-vps-de-chay-website\/\" target=\"_blank\" rel=\"noopener\">H\u01b0\u1edbng d\u1eabn c\u1ea5u h\u00ecnh VPS \u0111\u1ec3 ch\u1ea1y website<\/a> d\u00e0nh cho qu\u1ea3n tr\u1ecb vi\u00ean th\u1ef1c t\u1ebf. Kh\u00f4ng gi\u1ea3i th\u00edch VPS l\u00e0 g\u00ec hay Linux c\u01a1 b\u1ea3n \u2014 n\u1ebfu ch\u01b0a v\u00e0o \u0111\u01b0\u1ee3c server, \u0111\u1ecdc tr\u01b0\u1edbc <a href=\"https:\/\/interdata.vn\/blog\/cach-truy-cap-vps-linux-bang-ssh\/\" target=\"_blank\" rel=\"noopener\">c\u00e1ch SSH v\u00e0o VPS l\u1ea7n \u0111\u1ea7u<\/a> tr\u01b0\u1edbc khi ti\u1ebfp t\u1ee5c.<\/p>\n<figure style=\"text-align: center; margin: 24px 0;\"><img decoding=\"async\" style=\"max-width: 100%; height: auto; border-radius: 8px;\" src=\"https:\/\/interdata.vn\/blog\/wp-content\/uploads\/2026\/03\/Cai-dat-Nginx-PHP-va-MySQL-tren-Ubuntu-VPS.webp\" alt=\"C\u00e0i \u0111\u1eb7t Nginx, PHP v\u00e0 MySQL tr\u00ean Ubuntu VPS\" title=\"\"><figcaption style=\"font-style: italic; color: #555; margin-top: 8px;\">C\u00e0i \u0111\u1eb7t Nginx, PHP v\u00e0 MySQL tr\u00ean Ubuntu VPS<\/figcaption><\/figure>\n<h2><span class=\"ez-toc-section\" id=\"Yeu-Cau-Truoc-Khi-Bat-Dau\"><\/span>Y\u00eau C\u1ea7u Tr\u01b0\u1edbc Khi B\u1eaft \u0110\u1ea7u<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>Tr\u01b0\u1edbc khi ch\u1ea1y b\u1ea5t k\u1ef3 l\u1ec7nh n\u00e0o, ki\u1ec3m tra nhanh 4 \u0111i\u1ec1u sau:<\/p>\n<table style=\"width: 100%; border-collapse: collapse; margin-bottom: 20px;\">\n<thead>\n<tr>\n<th style=\"border: 1px solid #ddd; padding: 12px; text-align: left; background-color: #f9f9f9;\">Y\u00eau c\u1ea7u<\/th>\n<th style=\"border: 1px solid #ddd; padding: 12px; text-align: left; background-color: #f9f9f9;\">Ki\u1ec3m tra b\u1eb1ng l\u1ec7nh<\/th>\n<th style=\"border: 1px solid #ddd; padding: 12px; text-align: left; background-color: #f9f9f9;\">K\u1ebft qu\u1ea3 c\u1ea7n th\u1ea5y<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td style=\"border: 1px solid #ddd; padding: 12px;\">VPS ch\u1ea1y Ubuntu 22.04 ho\u1eb7c 24.04<\/td>\n<td style=\"border: 1px solid #ddd; padding: 12px;\"><code>lsb_release -a<\/code><\/td>\n<td style=\"border: 1px solid #ddd; padding: 12px;\">Ubuntu 22.04.x LTS ho\u1eb7c 24.04.x LTS<\/td>\n<\/tr>\n<tr>\n<td style=\"border: 1px solid #ddd; padding: 12px;\">\u0110ang login b\u1eb1ng root ho\u1eb7c user c\u00f3 sudo<\/td>\n<td style=\"border: 1px solid #ddd; padding: 12px;\"><code>whoami<\/code><\/td>\n<td style=\"border: 1px solid #ddd; padding: 12px;\"><code>root<\/code> ho\u1eb7c username c\u1ee7a b\u1ea1n<\/td>\n<\/tr>\n<tr>\n<td style=\"border: 1px solid #ddd; padding: 12px;\">VPS c\u00f3 k\u1ebft n\u1ed1i internet<\/td>\n<td style=\"border: 1px solid #ddd; padding: 12px;\"><code>ping -c 3 google.com<\/code><\/td>\n<td style=\"border: 1px solid #ddd; padding: 12px;\">3 packets transmitted, 0% packet loss<\/td>\n<\/tr>\n<tr>\n<td style=\"border: 1px solid #ddd; padding: 12px;\">Package list ch\u01b0a \u0111\u01b0\u1ee3c update<\/td>\n<td style=\"border: 1px solid #ddd; padding: 12px;\">\u2014<\/td>\n<td style=\"border: 1px solid #ddd; padding: 12px;\">Ch\u1ea1y <code>apt update<\/code> tr\u01b0\u1edbc ti\u00ean<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>B\u00e0i n\u00e0y d\u00f9ng Ubuntu 22.04 LTS l\u00e0m v\u00ed d\u1ee5 ch\u00ednh. Ng\u01b0\u1eddi d\u00f9ng Ubuntu 24.04 c\u00f3 th\u1ec3 l\u00e0m theo ho\u00e0n to\u00e0n \u2014 ch\u1ec9 c\u00f3 PHP default version kh\u00e1c, s\u1ebd ghi ch\u00fa r\u00f5 t\u1eebng ch\u1ed7. N\u1ebfu b\u1ea1n \u0111ang d\u00f9ng b\u1ea3n Ubuntu c\u0169 h\u01a1n (18.04, 20.04), khuy\u1ebfn ngh\u1ecb n\u00e2ng c\u1ea5p tr\u01b0\u1edbc; m\u1ed9t s\u1ed1 package trong b\u00e0i n\u00e0y c\u00f3 th\u1ec3 kh\u00f4ng available ho\u1eb7c c\u00f3 version kh\u00e1c.<\/p>\n<h2><span class=\"ez-toc-section\" id=\"Cai-Nginx-Tren-Ubuntu-VPS\"><\/span>C\u00e0i Nginx Tr\u00ean Ubuntu VPS<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<h3><span class=\"ez-toc-section\" id=\"Tai-sao-chon-Nginx-thay-vi-Apache-cho-VPS\"><\/span>T\u1ea1i sao ch\u1ecdn Nginx thay v\u00ec Apache cho VPS?<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p>Nginx x\u1eed l\u00fd concurrent connection t\u1ed1t h\u01a1n Apache \u0111\u00e1ng k\u1ec3 khi RAM th\u1ea5p \u2014 \u0111\u00e2y l\u00e0 l\u00fd do ch\u00ednh. Apache d\u00f9ng m\u00f4 h\u00ecnh process-based (m\u1ed7i request t\u1ea1o ra ho\u1eb7c d\u00f9ng 1 process\/thread ri\u00eang), trong khi Nginx d\u00f9ng event-driven non-blocking I\/O. Tr\u00ean VPS 1\u20132GB RAM v\u1edbi v\u00e0i tr\u0103m request \u0111\u1ed3ng th\u1eddi, Apache c\u00f3 th\u1ec3 ng\u1ed1n h\u1ebft RAM; Nginx v\u1eabn ch\u1ea1y \u1ed5n \u0111\u1ecbnh.<\/p>\n<table style=\"width: 100%; border-collapse: collapse; margin-bottom: 20px;\">\n<thead>\n<tr>\n<th style=\"border: 1px solid #ddd; padding: 12px; text-align: left; background-color: #f9f9f9;\">Ti\u00eau ch\u00ed<\/th>\n<th style=\"border: 1px solid #ddd; padding: 12px; text-align: left; background-color: #f9f9f9;\">Nginx<\/th>\n<th style=\"border: 1px solid #ddd; padding: 12px; text-align: left; background-color: #f9f9f9;\">Apache<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td style=\"border: 1px solid #ddd; padding: 12px;\">RAM usage khi idle<\/td>\n<td style=\"border: 1px solid #ddd; padding: 12px;\">~5\u201315 MB<\/td>\n<td style=\"border: 1px solid #ddd; padding: 12px;\">~20\u201350 MB (t\u00f9y module)<\/td>\n<\/tr>\n<tr>\n<td style=\"border: 1px solid #ddd; padding: 12px;\">X\u1eed l\u00fd concurrent connections<\/td>\n<td style=\"border: 1px solid #ddd; padding: 12px;\">T\u1ed1t \u2014 event-driven<\/td>\n<td style=\"border: 1px solid #ddd; padding: 12px;\">K\u00e9m h\u01a1n \u1edf traffic cao<\/td>\n<\/tr>\n<tr>\n<td style=\"border: 1px solid #ddd; padding: 12px;\">C\u1ea5u h\u00ecnh PHP<\/td>\n<td style=\"border: 1px solid #ddd; padding: 12px;\">Qua PHP-FPM (FastCGI)<\/td>\n<td style=\"border: 1px solid #ddd; padding: 12px;\">mod_php ho\u1eb7c PHP-FPM<\/td>\n<\/tr>\n<tr>\n<td style=\"border: 1px solid #ddd; padding: 12px;\">Static file serving<\/td>\n<td style=\"border: 1px solid #ddd; padding: 12px;\">R\u1ea5t nhanh<\/td>\n<td style=\"border: 1px solid #ddd; padding: 12px;\">Ch\u1eadm h\u01a1n Nginx<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>V\u1edbi VPS ph\u1ed5 th\u00f4ng 1\u20134GB RAM ch\u1ea1y WordPress, Laravel, hay \u1ee9ng d\u1ee5ng PHP th\u00f4ng th\u01b0\u1eddng \u2014 Nginx l\u00e0 l\u1ef1a ch\u1ecdn h\u1ee3p l\u00fd h\u01a1n. Apache v\u1eabn t\u1ed1t, nh\u01b0ng c\u1ea7n c\u1ea5u h\u00ecnh th\u00eam \u0111\u1ec3 \u0111\u1ea1t hi\u1ec7u su\u1ea5t t\u01b0\u01a1ng \u0111\u01b0\u01a1ng.<\/p>\n<h3><span class=\"ez-toc-section\" id=\"Cac-lenh-cai-Nginx-tren-Ubuntu-2204-2404\"><\/span>C\u00e1c l\u1ec7nh c\u00e0i Nginx tr\u00ean Ubuntu 22.04 \/ 24.04<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p>B\u1eaft \u0111\u1ea7u b\u1eb1ng update package list tr\u01b0\u1edbc \u2014 b\u01b0\u1edbc n\u00e0y nhi\u1ec1u ng\u01b0\u1eddi b\u1ecf qua r\u1ed3i th\u1eafc m\u1eafc t\u1ea1i sao c\u00e0i \u0111\u01b0\u1ee3c version c\u0169.<\/p>\n<pre><code># C\u1eadp nh\u1eadt danh s\u00e1ch package\r\napt update<\/code><\/pre>\n<figure style=\"text-align: center; margin: 24px 0;\"><img decoding=\"async\" style=\"max-width: 100%; height: auto; border-radius: 8px;\" src=\"https:\/\/interdata.vn\/blog\/wp-content\/uploads\/2026\/03\/Cap-nhat-danh-sach-package.png\" alt=\"C\u1eadp nh\u1eadt danh s\u00e1ch package\" title=\"\"><figcaption style=\"font-style: italic; color: #555; margin-top: 8px;\">C\u1eadp nh\u1eadt danh s\u00e1ch package<\/figcaption><\/figure>\n<pre><code># C\u00e0i Nginx\r\napt install nginx -y\r\n\r\n# Enable Nginx kh\u1edfi \u0111\u1ed9ng c\u00f9ng server (quan tr\u1ecdng \u2014 n\u1ebfu kh\u00f4ng, reboot xong Nginx s\u1ebd kh\u00f4ng t\u1ef1 ch\u1ea1y)\r\nsystemctl enable nginx\r\n\r\n# Kh\u1edfi \u0111\u1ed9ng Nginx ngay\r\nsystemctl start nginx<\/code><\/pre>\n<figure style=\"text-align: center; margin: 24px 0;\"><img decoding=\"async\" style=\"max-width: 100%; height: auto; border-radius: 8px;\" src=\"https:\/\/interdata.vn\/blog\/wp-content\/uploads\/2026\/03\/Cai-dat-bat-va-khoi-dong-Nginx.png\" alt=\"C\u00e0i \u0111\u1eb7t, b\u1eadt v\u00e0 kh\u1edfi \u0111\u1ed9ng Nginx\" title=\"\"><figcaption style=\"font-style: italic; color: #555; margin-top: 8px;\">C\u00e0i \u0111\u1eb7t, b\u1eadt v\u00e0 kh\u1edfi \u0111\u1ed9ng Nginx<\/figcaption><\/figure>\n<p>Sau \u0111\u00f3 m\u1edf port 80 tr\u00ean firewall:<\/p>\n<pre><code># Cho ph\u00e9p HTTP (port 80) v\u00e0 HTTPS (port 443)\r\nufw allow 'Nginx Full'\r\n\r\n# Ki\u1ec3m tra ufw \u0111ang active ch\u01b0a\r\nufw status<\/code><\/pre>\n<figure style=\"text-align: center; margin: 24px 0;\"><img decoding=\"async\" style=\"max-width: 100%; height: auto; border-radius: 8px;\" src=\"https:\/\/interdata.vn\/blog\/wp-content\/uploads\/2026\/03\/Kiem-tra-trang-thai-cua-ufw.png\" alt=\"Ki\u1ec3m tra tr\u1ea1ng th\u00e1i c\u1ee7a ufw\" title=\"\"><figcaption style=\"font-style: italic; color: #555; margin-top: 8px;\">Ki\u1ec3m tra tr\u1ea1ng th\u00e1i c\u1ee7a ufw<\/figcaption><\/figure>\n<p>N\u1ebfu PuTTY b\u00e1o <code>command 'ufw' not found...<\/code>, th\u00ec \u0111\u00e2y l\u00e0 v\u1ea5n \u0111\u1ec1 do ch\u01b0a c\u00e0i \u0111\u1eb7t ufw. Khi \u1ea5y h\u00e3y c\u00e0i \u0111\u1eb7t ufw b\u1eb1ng <code>apt install ufw<\/code> v\u00e0 b\u1eadt ufw b\u1eb1ng <code>ufw enable<\/code> \u2014 nh\u01b0ng nh\u1edb allow port SSH (22) tr\u01b0\u1edbc: <code>ufw allow OpenSSH<\/code>. Kh\u00f4ng th\u00ec b\u1ea1n s\u1ebd b\u1ecb kh\u00f3a kh\u1ecfi server ngay sau khi enable firewall. Ubuntu 24.04 d\u00f9ng l\u1ec7nh ho\u00e0n to\u00e0n t\u01b0\u01a1ng t\u1ef1 \u2014 kh\u00f4ng c\u00f3 g\u00ec kh\u00e1c bi\u1ec7t \u1edf b\u01b0\u1edbc c\u1ea5u h\u00ecnh Nginx n\u00e0y.<\/p>\n<h3><span class=\"ez-toc-section\" id=\"Lam-sao-biet-Nginx-da-chay-thanh-cong\"><\/span>L\u00e0m sao bi\u1ebft Nginx \u0111\u00e3 ch\u1ea1y th\u00e0nh c\u00f4ng?<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p>Ch\u1ea1y l\u1ec7nh sau \u0111\u1ec3 ki\u1ec3m tra tr\u1ea1ng th\u00e1i service:<\/p>\n<pre><code>systemctl status nginx<\/code><\/pre>\n<p>K\u1ebft qu\u1ea3 c\u1ea7n th\u1ea5y l\u00e0 d\u00f2ng <code>Active: active (running)<\/code> m\u00e0u xanh l\u00e1. N\u1ebfu th\u1ea5y <code>failed<\/code> ho\u1eb7c <code>inactive<\/code> th\u00ec Nginx ch\u01b0a ch\u1ea1y \u2014 c\u1ea7n xem log \u0111\u1ec3 t\u00ecm nguy\u00ean nh\u00e2n.<\/p>\n<figure style=\"text-align: center; margin: 24px 0;\"><img decoding=\"async\" style=\"max-width: 100%; height: auto; border-radius: 8px;\" src=\"https:\/\/interdata.vn\/blog\/wp-content\/uploads\/2026\/03\/Trang-thai-cai-dat-Nginx-cai-dat-thanh-cong.png\" alt=\"Tr\u1ea1ng th\u00e1i c\u00e0i \u0111\u1eb7t Nginx c\u00e0i \u0111\u1eb7t th\u00e0nh c\u00f4ng\" title=\"\"><figcaption style=\"font-style: italic; color: #555; margin-top: 8px;\">Tr\u1ea1ng th\u00e1i c\u00e0i \u0111\u1eb7t Nginx c\u00e0i \u0111\u1eb7t th\u00e0nh c\u00f4ng<\/figcaption><\/figure>\n<p>C\u00e1ch 2 \u2014 tr\u1ef1c quan h\u01a1n: m\u1edf tr\u00ecnh duy\u1ec7t, nh\u1eadp IP VPS v\u00e0o thanh \u0111\u1ecba ch\u1ec9. N\u1ebfu th\u1ea5y trang &#8220;Welcome to nginx!&#8221; l\u00e0 xong. Kh\u00f4ng th\u1ea5y trang \u0111\u00f3? H\u00e3y ki\u1ec3m tra 2 nguy\u00ean nh\u00e2n ph\u1ed5 bi\u1ebfn nh\u1ea5t:<\/p>\n<ul>\n<li><strong>ufw ch\u01b0a m\u1edf port 80<\/strong> \u2014 ch\u1ea1y <code>ufw allow 80\/tcp<\/code> r\u1ed3i th\u1eed l\u1ea1i<\/li>\n<li><strong>Nginx ch\u01b0a start<\/strong> \u2014 ch\u1ea1y <code>systemctl start nginx<\/code><\/li>\n<\/ul>\n<pre><code># N\u1ebfu Nginx b\u1ecb l\u1ed7i, xem log \u0111\u1ec3 t\u00ecm nguy\u00ean nh\u00e2n\r\njournalctl -xe --unit nginx<\/code><\/pre>\n<h2><span class=\"ez-toc-section\" id=\"Cai-PHP-FPM-Va-Cac-Extension-Can-Thiet\"><\/span>C\u00e0i PHP-FPM V\u00e0 C\u00e1c Extension C\u1ea7n Thi\u1ebft<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<h3><span class=\"ez-toc-section\" id=\"Nen-cai-PHP-version-nao-cho-Ubuntu-2204-2404\"><\/span>N\u00ean c\u00e0i PHP version n\u00e0o cho Ubuntu 22.04 \/ 24.04?<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p>Ubuntu 22.04 LTS \u0111i k\u00e8m PHP 8.1 trong repository m\u1eb7c \u0111\u1ecbnh. Tuy nhi\u00ean, khuy\u1ebfn ngh\u1ecb d\u00f9ng PHP 8.3 \u2014 l\u00fd do: PHP 8.1 s\u1ebd h\u1ebft security support v\u00e0o th\u00e1ng 12\/2025, trong khi PHP 8.3 \u0111\u01b0\u1ee3c support \u0111\u1ebfn th\u00e1ng 12\/2027. WordPress 6.x v\u00e0 Laravel 11.x \u0111\u1ec1u t\u01b0\u01a1ng th\u00edch t\u1ed1t v\u1edbi 8.3. \u0110\u1ec3 c\u00e0i PHP 8.3 tr\u00ean Ubuntu 22.04, c\u1ea7n th\u00eam PPA t\u1eeb Ond\u0159ej Sur\u00fd \u2014 maintainer PHP package uy t\u00edn nh\u1ea5t cho Ubuntu. Ubuntu 24.04 kh\u00f4ng c\u1ea7n th\u00eam PPA \u2014 PHP 8.3 \u0111\u00e3 c\u00f3 s\u1eb5n trong repository m\u1eb7c \u0111\u1ecbnh.<\/p>\n<table style=\"width: 100%; border-collapse: collapse; margin-bottom: 20px;\">\n<thead>\n<tr>\n<th style=\"border: 1px solid #ddd; padding: 12px; text-align: left; background-color: #f9f9f9;\">Ubuntu Version<\/th>\n<th style=\"border: 1px solid #ddd; padding: 12px; text-align: left; background-color: #f9f9f9;\">PHP m\u1eb7c \u0111\u1ecbnh<\/th>\n<th style=\"border: 1px solid #ddd; padding: 12px; text-align: left; background-color: #f9f9f9;\">PHP khuy\u1ebfn ngh\u1ecb 2025<\/th>\n<th style=\"border: 1px solid #ddd; padding: 12px; text-align: left; background-color: #f9f9f9;\">C\u1ea7n PPA?<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td style=\"border: 1px solid #ddd; padding: 12px;\">Ubuntu 22.04 LTS<\/td>\n<td style=\"border: 1px solid #ddd; padding: 12px;\">PHP 8.1<\/td>\n<td style=\"border: 1px solid #ddd; padding: 12px;\">PHP 8.3<\/td>\n<td style=\"border: 1px solid #ddd; padding: 12px;\">C\u00f3 (ondrej\/php)<\/td>\n<\/tr>\n<tr>\n<td style=\"border: 1px solid #ddd; padding: 12px;\">Ubuntu 24.04 LTS<\/td>\n<td style=\"border: 1px solid #ddd; padding: 12px;\">PHP 8.3<\/td>\n<td style=\"border: 1px solid #ddd; padding: 12px;\">PHP 8.3<\/td>\n<td style=\"border: 1px solid #ddd; padding: 12px;\">Kh\u00f4ng c\u1ea7n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>L\u01b0u \u00fd th\u1eddi h\u1ea1n: PHP 8.1 h\u1ebft security support v\u00e0o <strong>12\/2025<\/strong>. PHP 8.3 h\u1ebft security support v\u00e0o <strong>12\/2027<\/strong>. PHP 8.4 \u0111\u00e3 release th\u00e1ng 11\/2024 nh\u01b0ng ch\u01b0a \u0111\u01b0\u1ee3c recommend cho production v\u00ec h\u1ec7 sinh th\u00e1i plugin\/theme ch\u01b0a c\u1eadp nh\u1eadt \u0111\u1ea7y \u0111\u1ee7 \u0111\u1ec3 t\u01b0\u01a1ng th\u00edch ho\u00e0n to\u00e0n.<\/p>\n<h3><span class=\"ez-toc-section\" id=\"Cac-lenh-cai-PHP-FPM-va-extension-pho-bien\"><\/span>C\u00e1c l\u1ec7nh c\u00e0i PHP-FPM v\u00e0 extension ph\u1ed5 bi\u1ebfn<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p>V\u1edbi Ubuntu 22.04 \u2014 b\u1ea1n c\u1ea7n th\u00eam kho PPA tr\u01b0\u1edbc:<\/p>\n<pre><code># Th\u00eam PPA c\u1ee7a Ond\u0159ej Sur\u00fd (c\u1ea7n tr\u00ean Ubuntu 22.04)\r\nadd-apt-repository ppa:ondrej\/php -y\r\napt update<\/code><\/pre>\n<p>V\u1edbi Ubuntu 24.04 \u2014 h\u00e3y b\u1ecf qua 2 l\u1ec7nh tr\u00ean, ti\u1ebfn h\u00e0nh b\u1eaft \u0111\u1ea7u tr\u1ef1c ti\u1ebfp t\u1eeb \u0111\u00e2y:<\/p>\n<pre><code># C\u00e0i PHP 8.3 FPM\r\napt install php8.3-fpm -y\r\n\r\n# C\u00e0i extension ph\u1ed5 bi\u1ebfn\r\napt install php8.3-mysql php8.3-curl php8.3-xml php8.3-mbstring php8.3-zip php8.3-gd -y\r\n\r\n# Kh\u1edfi \u0111\u1ed9ng v\u00e0 enable PHP-FPM\r\nsystemctl enable php8.3-fpm\r\nsystemctl start php8.3-fpm<\/code><\/pre>\n<figure style=\"text-align: center; margin: 24px 0;\"><img decoding=\"async\" style=\"max-width: 100%; height: auto; border-radius: 8px;\" src=\"https:\/\/interdata.vn\/blog\/wp-content\/uploads\/2026\/03\/Trang-thai-cai-dat-PHP-FPM-8.3-thanh-cong.png\" alt=\"Tr\u1ea1ng th\u00e1i c\u00e0i \u0111\u1eb7t PHP-FPM 8.3 th\u00e0nh c\u00f4ng\" title=\"\"><figcaption style=\"font-style: italic; color: #555; margin-top: 8px;\">Tr\u1ea1ng th\u00e1i c\u00e0i \u0111\u1eb7t PHP-FPM 8.3 th\u00e0nh c\u00f4ng<\/figcaption><\/figure>\n<p>Gi\u1ea3i th\u00edch nhanh t\u1eebng extension \u0111\u01b0\u1ee3c y\u00eau c\u1ea7u:<\/p>\n<ul>\n<li><strong>php8.3-mysql<\/strong> \u2014 k\u1ebft n\u1ed1i PHP v\u1edbi MySQL\/MariaDB; thi\u1ebfu module n\u00e0y WordPress s\u1ebd kh\u00f4ng ch\u1ea1y \u0111\u01b0\u1ee3c<\/li>\n<li><strong>php8.3-curl<\/strong> \u2014 g\u1ecdi API b\u00ean ngo\u00e0i, x\u1eed l\u00fd HTTP request t\u1eeb PHP<\/li>\n<li><strong>php8.3-xml<\/strong> \u2014 parse XML, c\u1ea7n thi\u1ebft cho nhi\u1ec1u CMS v\u00e0 framework hi\u1ec7n t\u1ea1i<\/li>\n<li><strong>php8.3-mbstring<\/strong> \u2014 x\u1eed l\u00fd chu\u1ed7i \u0111a byte (ti\u1ebfng Vi\u1ec7t, k\u00fd t\u1ef1 Unicode)<\/li>\n<li><strong>php8.3-zip<\/strong> \u2014 gi\u1ea3i n\u00e9n file ZIP t\u1eeb PHP; WordPress c\u1ea7n th\u01b0 vi\u1ec7n n\u00e0y khi install plugin\/theme m\u1edbi<\/li>\n<li><strong>php8.3-gd<\/strong> \u2014 x\u1eed l\u00fd \u1ea3nh (resize, watermark); thi\u1ebfu th\u00ec h\u00ecnh \u1ea3nh t\u1ea3i l\u00ean trong WordPress c\u00f3 th\u1ec3 b\u1ecb l\u1ed7i<\/li>\n<\/ul>\n<p>N\u1ebfu b\u1ea1n c\u1ea7n setup th\u00eam ri\u00eang cho Laravel, c\u00f3 th\u1ec3 b\u1ed5 sung c\u00e1c l\u1ec7nh: <code>php8.3-bcmath php8.3-intl php8.3-redis<\/code>.<\/p>\n<h3><span class=\"ez-toc-section\" id=\"Cach-ket-noi-Nginx-voi-PHP-FPM-qua-server-block\"><\/span>C\u00e1ch k\u1ebft n\u1ed1i Nginx v\u1edbi PHP-FPM qua server block<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p>\u0110\u00e2y l\u00e0 b\u01b0\u1edbc qu\u1ea3n tr\u1ecb vi\u00ean hay b\u1ecb b\u1ecf qua nh\u1ea5t. C\u00e0i PHP-FPM xong m\u00e0 kh\u00f4ng c\u1ea5u h\u00ecnh Nginx server block \u0111\u00fang th\u00ec PHP v\u1eabn kh\u00f4ng ch\u1ea1y \u2014 Nginx ch\u1ec9 tr\u1ea3 v\u1ec1 file .php th\u00f4 thay v\u00ec th\u1ef1c thi n\u00f3. M\u1edf file config Nginx cho site c\u1ee7a b\u1ea1n b\u1eb1ng <code>sudo nano \/etc\/nginx\/sites-available\/default<\/code>, th\u00eam ho\u1eb7c s\u1eeda block x\u1eed l\u00fd PHP nh\u01b0 sau:<\/p>\n<pre><code>server {\r\n    listen 80;\r\n    server_name your-domain.com;  # Ho\u1eb7c IP VPS n\u1ebfu ch\u01b0a c\u00f3 domain\r\n    root \/var\/www\/html;\r\n    index index.php index.html;\r\n\r\n    location \/ {\r\n        try_files $uri $uri\/ =404;\r\n    }\r\n\r\n    # Block quan tr\u1ecdng \u2014 k\u1ebft n\u1ed1i Nginx v\u1edbi PHP-FPM\r\n    location ~ \\.php$ {\r\n        include snippets\/fastcgi-php.conf;\r\n        # Socket path ph\u1ea3i kh\u1edbp v\u1edbi version PHP \u0111ang c\u00e0i\r\n        fastcgi_pass unix:\/run\/php\/php8.3-fpm.sock;\r\n    }\r\n\r\n    location ~ \/\\.ht {\r\n        deny all;\r\n    }\r\n}<\/code><\/pre>\n<p>3 d\u00f2ng quan tr\u1ecdng nh\u1ea5t b\u1ea1n c\u1ea7n \u0111\u1ec3 \u00fd k\u1ef9 trong kh\u1ed1i c\u1ea5u h\u00ecnh:<\/p>\n<ul>\n<li><code>location ~ \\.php$<\/code> \u2014 ch\u1ec9 \u0111\u1ecbnh Nginx chuy\u1ec3n m\u1ecdi file c\u00f3 \u0111u\u00f4i .php sang PHP-FPM x\u1eed l\u00fd.<\/li>\n<li><code>fastcgi_pass unix:\/run\/php\/php8.3-fpm.sock<\/code> \u2014 socket path ph\u1ea3i kh\u1edbp ch\u00ednh x\u00e1c v\u1edbi version PHP. N\u1ebfu c\u00e0i PHP 8.1 th\u00ec path l\u00e0 <code>php8.1-fpm.sock<\/code>. Sai chi ti\u1ebft n\u00e0y \u2192 b\u1ea1n s\u1ebd nh\u1eadn l\u1ed7i 502 Bad Gateway ngay.<\/li>\n<li><code>include snippets\/fastcgi-php.conf<\/code> \u2014 file c\u1ea5u h\u00ecnh c\u00f3 s\u1eb5n c\u1ee7a Ubuntu, ch\u1ee9a c\u00e1c fastcgi_param c\u1ea7n thi\u1ebft.<\/li>\n<\/ul>\n<figure style=\"text-align: center; margin: 24px 0;\"><img decoding=\"async\" style=\"max-width: 100%; height: auto; border-radius: 8px;\" src=\"https:\/\/interdata.vn\/blog\/wp-content\/uploads\/2026\/03\/Ket-noi-Nginx-voi-PHP-FPM-qua-server-block.png\" alt=\"K\u1ebft n\u1ed1i Nginx v\u1edbi PHP-FPM qua server block\" title=\"\"><figcaption style=\"font-style: italic; color: #555; margin-top: 8px;\">K\u1ebft n\u1ed1i Nginx v\u1edbi PHP-FPM qua server block<\/figcaption><\/figure>\n<p>Sau khi s\u1eeda file config, h\u00e3y test k\u1ef9 syntax v\u00e0 th\u1ef1c hi\u1ec7n reload:<\/p>\n<pre><code># Ki\u1ec3m tra syntax config tr\u01b0\u1edbc khi reload (quan tr\u1ecdng)\r\nnginx -t\r\n\r\n# N\u1ebfu kh\u00f4ng c\u00f3 l\u1ed7i \u2192 ti\u1ebfn h\u00e0nh reload\r\nsystemctl reload nginx<\/code><\/pre>\n<figure style=\"text-align: center; margin: 24px 0;\"><img decoding=\"async\" style=\"max-width: 100%; height: auto; border-radius: 8px;\" src=\"https:\/\/interdata.vn\/blog\/wp-content\/uploads\/2026\/03\/Test-va-Reload-Nginx.png\" alt=\"Test v\u00e0 Reload Nginx\" title=\"\"><figcaption style=\"font-style: italic; color: #555; margin-top: 8px;\">Test v\u00e0 Reload Nginx<\/figcaption><\/figure>\n<h2><span class=\"ez-toc-section\" id=\"Cai-MySQL-Tren-Ubuntu-VPS\"><\/span>C\u00e0i MySQL Tr\u00ean Ubuntu VPS<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<h3><span class=\"ez-toc-section\" id=\"Nen-chon-MySQL-hay-MariaDB-cho-VPS-Ubuntu\"><\/span>N\u00ean ch\u1ecdn MySQL hay MariaDB cho VPS Ubuntu?<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p>MariaDB l\u00e0 b\u1ea3n fork tr\u1ef1c ti\u1ebfp c\u1ee7a MySQL, t\u01b0\u01a1ng th\u00edch ng\u01b0\u1ee3c v\u1edbi h\u1ea7u h\u1ebft query v\u00e0 application. N\u1ebfu ch\u1ea1y WordPress, Joomla, Drupal, hay c\u00e1c \u1ee9ng d\u1ee5ng PHP th\u00f4ng th\u01b0\u1eddng \u2014 MariaDB 10.x ho\u1ea1t \u0111\u1ed9ng \u1ed5n \u0111\u1ecbnh v\u00e0 nh\u1eb9 h\u01a1n MySQL 8.0 m\u1ed9t ch\u00fat. Ng\u01b0\u1ee3c l\u1ea1i, MySQL 8.0 ph\u00f9 h\u1ee3p h\u01a1n n\u1ebfu b\u1ea1n c\u1ea7n JSON column type n\u00e2ng cao, CTE (Common Table Expressions), ho\u1eb7c window function \u2014 c\u00e1c t\u00ednh n\u0103ng \u0111\u1eb7c th\u00f9 m\u00e0 MySQL 8.0 implement t\u1ed1t h\u01a1n \u1edf th\u1eddi \u0111i\u1ec3m hi\u1ec7n t\u1ea1i.<\/p>\n<table style=\"width: 100%; border-collapse: collapse; margin-bottom: 20px;\">\n<thead>\n<tr>\n<th style=\"border: 1px solid #ddd; padding: 12px; text-align: left; background-color: #f9f9f9;\">Ti\u00eau ch\u00ed<\/th>\n<th style=\"border: 1px solid #ddd; padding: 12px; text-align: left; background-color: #f9f9f9;\">MySQL 8.0<\/th>\n<th style=\"border: 1px solid #ddd; padding: 12px; text-align: left; background-color: #f9f9f9;\">MariaDB 10.x<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td style=\"border: 1px solid #ddd; padding: 12px;\">T\u01b0\u01a1ng th\u00edch WordPress\/Joomla<\/td>\n<td style=\"border: 1px solid #ddd; padding: 12px;\">T\u1ed1t<\/td>\n<td style=\"border: 1px solid #ddd; padding: 12px;\">T\u1ed1t (th\u01b0\u1eddng t\u1ed1t h\u01a1n)<\/td>\n<\/tr>\n<tr>\n<td style=\"border: 1px solid #ddd; padding: 12px;\">RAM usage<\/td>\n<td style=\"border: 1px solid #ddd; padding: 12px;\">Nh\u1ec9nh h\u01a1n ~10\u201320%<\/td>\n<td style=\"border: 1px solid #ddd; padding: 12px;\">Nh\u1eb9 h\u01a1n<\/td>\n<\/tr>\n<tr>\n<td style=\"border: 1px solid #ddd; padding: 12px;\">JSON support<\/td>\n<td style=\"border: 1px solid #ddd; padding: 12px;\">\u0110\u1ea7y \u0111\u1ee7, native<\/td>\n<td style=\"border: 1px solid #ddd; padding: 12px;\">C\u00f3 nh\u01b0ng h\u1ea1n ch\u1ebf h\u01a1n<\/td>\n<\/tr>\n<tr>\n<td style=\"border: 1px solid #ddd; padding: 12px;\">License<\/td>\n<td style=\"border: 1px solid #ddd; padding: 12px;\">GPL + Oracle commercial<\/td>\n<td style=\"border: 1px solid #ddd; padding: 12px;\">GPL ho\u00e0n to\u00e0n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>K\u1ebft lu\u1eadn th\u1ef1c t\u1ebf: h\u00e3y ch\u1ecdn d\u00f9ng MariaDB n\u1ebfu b\u1ea1n kh\u00f4ng c\u00f3 y\u00eau c\u1ea7u \u0111\u1eb7c th\u00f9 n\u00e0o. B\u00e0i n\u00e0y s\u1ebd h\u01b0\u1edbng d\u1eabn c\u00e0i MySQL 8.0 l\u00e0m m\u1eabu \u2014 n\u1ebfu mu\u1ed1n d\u00f9ng MariaDB, b\u1ea1n ch\u1ec9 c\u1ea7n thay <code>mysql-server<\/code> b\u1eb1ng <code>mariadb-server<\/code> trong l\u1ec7nh c\u00e0i, c\u00e1c b\u01b0\u1edbc c\u00f2n l\u1ea1i \u0111\u01b0\u1ee3c c\u1ea5u h\u00ecnh gi\u1ed1ng h\u1ec7t.<\/p>\n<h3><span class=\"ez-toc-section\" id=\"Cac-lenh-cai-MySQL-80-tren-Ubuntu\"><\/span>C\u00e1c l\u1ec7nh c\u00e0i MySQL 8.0 tr\u00ean Ubuntu<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<pre><code># C\u00e0i MySQL Server\r\napt install mysql-server -y\r\n\r\n# Enable v\u00e0 start MySQL\r\nsystemctl enable mysql\r\nsystemctl start mysql<\/code><\/pre>\n<figure style=\"text-align: center; margin: 24px 0;\"><img decoding=\"async\" style=\"max-width: 100%; height: auto; border-radius: 8px;\" src=\"https:\/\/interdata.vn\/blog\/wp-content\/uploads\/2026\/03\/Thong-bao-cai-dat-MySQL-thanh-cong.png\" alt=\"Tr\u1ea1ng th\u00e1i c\u00e0i \u0111\u1eb7t MySQL th\u00e0nh c\u00f4ng\" title=\"\"><figcaption style=\"font-style: italic; color: #555; margin-top: 8px;\">Tr\u1ea1ng th\u00e1i c\u00e0i \u0111\u1eb7t MySQL th\u00e0nh c\u00f4ng<\/figcaption><\/figure>\n<p>Sau \u0111\u00f3 ch\u1ea1y wizard b\u1ea3o m\u1eadt \u2014 b\u01b0\u1edbc n\u00e0y kh\u00f4ng th\u1ec3 b\u1ecf qua \u0111\u01b0\u1ee3c n\u1ebfu b\u1ea1n c\u1ea5u h\u00ecnh VPS d\u00f9ng cho production:<\/p>\n<pre><code>mysql_secure_installation<\/code><\/pre>\n<p>Wizard c\u1ea5u h\u00ecnh s\u1ebd y\u00eau c\u1ea7u b\u1ea1n tr\u1ea3 l\u1eddi l\u1ea7n l\u01b0\u1ee3t c\u00e1c thi\u1ebft l\u1eadp:<\/p>\n<ul>\n<li><strong>VALIDATE PASSWORD component<\/strong> \u2014 n\u00ean ch\u1ecdn <code>Y<\/code>, sau \u0111\u00f3 ch\u1ecdn level 1 (MEDIUM) \u0111\u1ed1i v\u1edbi m\u00f4i tr\u01b0\u1eddng VPS ph\u1ed5 th\u00f4ng.<\/li>\n<li><strong>Change the password for root<\/strong> \u2014 b\u1eaft bu\u1ed9c \u0111\u1eb7t password m\u1ea1nh, l\u01b0u l\u1ea1i c\u1ea9n th\u1eadn.<\/li>\n<li><strong>Remove anonymous users<\/strong> \u2014 ch\u1ecdn <code>Y<\/code>, lu\u00f4n lu\u00f4n g\u1ee1 b\u1ecf user v\u00f4 danh.<\/li>\n<li><strong>Disallow root login remotely<\/strong> \u2014 ch\u1ecdn <code>Y<\/code>; user root c\u1ee7a MySQL tuy\u1ec7t \u0111\u1ed1i kh\u00f4ng n\u00ean \u0111\u01b0\u1ee3c login t\u1eeb xa.<\/li>\n<li><strong>Remove test database<\/strong> \u2014 ch\u1ecdn <code>Y<\/code> \u0111\u1ec3 d\u1ecdn d\u1eb9p data th\u1eeba.<\/li>\n<li><strong>Reload privilege tables<\/strong> \u2014 ch\u1ecdn <code>Y<\/code> \u0111\u1ec3 thay \u0111\u1ed5i c\u00f3 hi\u1ec7u l\u1ef1c ngay l\u1eadp t\u1ee9c.<\/li>\n<\/ul>\n<figure style=\"text-align: center; margin: 24px 0;\"><img decoding=\"async\" style=\"max-width: 100%; height: auto; border-radius: 8px;\" src=\"https:\/\/interdata.vn\/blog\/wp-content\/uploads\/2026\/03\/Chay-Wizard-bao-mat.png\" alt=\"Ch\u1ea1y Wizard b\u1ea3o m\u1eadt\" title=\"\"><figcaption style=\"font-style: italic; color: #555; margin-top: 8px;\">Ch\u1ea1y Wizard b\u1ea3o m\u1eadt<\/figcaption><\/figure>\n<h3><span class=\"ez-toc-section\" id=\"Tao-database-va-user-MySQL-dau-tien-cho-ung-dung\"><\/span>T\u1ea1o database v\u00e0 user MySQL \u0111\u1ea7u ti\u00ean cho \u1ee9ng d\u1ee5ng<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p>Kh\u00f4ng bao gi\u1edd d\u00f9ng t\u00e0i kho\u1ea3n root MySQL tr\u1ef1c ti\u1ebfp cho \u1ee9ng d\u1ee5ng \u2014 \u0111\u00e2y l\u00e0 m\u1ed9t r\u1ee7i ro b\u1ea3o m\u1eadt nghi\u00eam tr\u1ecdng. M\u1ed7i website hay \u1ee9ng d\u1ee5ng n\u00ean \u0111\u01b0\u1ee3c c\u1ea5p 1 database ri\u00eang, \u0111i k\u00e8m 1 user ri\u00eang ch\u1ec9 c\u00f3 quy\u1ec1n tr\u00ean \u0111\u00fang database \u0111\u00f3.<\/p>\n<pre><code># \u0110\u0103ng nh\u1eadp MySQL v\u1edbi quy\u1ec1n root\r\nmysql -u root -p\r\n\r\n# T\u1ea1o database m\u1edbi (thay your_database b\u1eb1ng t\u00ean th\u1ef1c t\u1ebf)\r\nCREATE DATABASE your_database CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;\r\n\r\n# T\u1ea1o user m\u1edbi\r\nCREATE USER 'your_user'@'localhost' IDENTIFIED BY 'your_strong_password';\r\n\r\n# C\u1ea5p quy\u1ec1n tr\u00ean database v\u1eeba t\u1ea1o\r\nGRANT ALL PRIVILEGES ON your_database.* TO 'your_user'@'localhost';\r\n\r\n# \u00c1p d\u1ee5ng thay \u0111\u1ed5i quy\u1ec1n\r\nFLUSH PRIVILEGES;\r\n\r\n# Tho\u00e1t MySQL\r\nEXIT;<\/code><\/pre>\n<figure style=\"text-align: center; margin: 24px 0;\"><img decoding=\"async\" style=\"max-width: 100%; height: auto; border-radius: 8px;\" src=\"https:\/\/interdata.vn\/blog\/wp-content\/uploads\/2026\/03\/Tao-database-va-user-MySQL-dau-tien-cho-ung-dung.png\" alt=\"T\u1ea1o database v\u00e0 user MySQL \u0111\u1ea7u ti\u00ean cho \u1ee9ng d\u1ee5ng\" title=\"\"><figcaption style=\"font-style: italic; color: #555; margin-top: 8px;\">T\u1ea1o database v\u00e0 user MySQL \u0111\u1ea7u ti\u00ean cho \u1ee9ng d\u1ee5ng<\/figcaption><\/figure>\n<p>H\u00e3y l\u01b0u \u00fd vi\u1ec7c s\u1eed d\u1ee5ng <code>utf8mb4<\/code> thay v\u00ec <code>utf8<\/code> c\u0169 \u2014 charset n\u00e0y h\u1ed7 tr\u1ee3 emoji v\u00e0 k\u00fd t\u1ef1 Unicode \u0111\u1ea7y \u0111\u1ee7, \u0111\u1ea3m b\u1ea3o tr\u00e1nh l\u1ed7i khi l\u01b0u n\u1ed9i dung ti\u1ebfng Vi\u1ec7t c\u00f3 d\u1ea5u v\u00e0 c\u00e1c k\u00fd t\u1ef1 \u0111\u1eb7c bi\u1ec7t tr\u00ean web.<\/p>\n<h2><span class=\"ez-toc-section\" id=\"Kiem-Tra-Toan-Bo-LEMP-Stack-Hoat-Dong\"><\/span>Ki\u1ec3m Tra To\u00e0n B\u1ed9 LEMP Stack Ho\u1ea1t \u0110\u1ed9ng<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>Sau khi qu\u00e1 tr\u00ecnh c\u00e0i \u0111\u1eb7t Nginx + PHP + MySQL tr\u00ean Ubuntu VPS ho\u00e0n thi\u1ec7n, b\u1ea1n n\u00ean t\u1ea1o m\u1ed9t file PHP test t\u0129nh \u0111\u1ec3 verify xem to\u00e0n b\u1ed9 stack \u0111ang ch\u1ea1y \u0111\u1ed3ng b\u1ed9 \u0111\u00fang c\u00e1ch ch\u01b0a:<\/p>\n<pre><code># T\u1ea1o file phpinfo \u0111\u1ec3 test\r\necho \"&lt;?php phpinfo(); ?&gt;\" &gt; \/var\/www\/html\/info.php<\/code><\/pre>\n<p>M\u1edf tr\u00ecnh duy\u1ec7t web c\u1ee7a b\u1ea1n, truy c\u1eadp ngay v\u00e0o \u0111\u01b0\u1eddng d\u1eabn: <code>http:\/\/&lt;IP_VPS&gt;\/info.php<\/code>. N\u1ebfu trang hi\u1ec3n th\u1ecb \u0111\u1ea7y \u0111\u1ee7 th\u00f4ng tin PHP v\u1edbi c\u00e1c module li\u1ec7t k\u00ea r\u00f5 r\u00e0ng \u2014 LEMP stack c\u1ee7a b\u1ea1n \u0111\u00e3 ho\u1ea1t \u0111\u1ed9ng \u0111\u00fang. Ki\u1ec3m tra nhanh c\u00e1c m\u1ee5c quan tr\u1ecdng tr\u00ean trang phpinfo n\u00e0y: <strong>PHP Version<\/strong> (b\u1eaft bu\u1ed9c ph\u1ea3i l\u00e0 8.3.x), <strong>Server API<\/strong> (ph\u1ea3i ghi nh\u1eadn l\u00e0 FPM\/FastCGI \u2014 kh\u00f4ng ph\u1ea3i Apache), v\u00e0 <strong>mysqli<\/strong> ho\u1eb7c <strong>PDO_MySQL<\/strong> ph\u1ea3i c\u00f3 m\u1eb7t trong danh s\u00e1ch module.<\/p>\n<p><strong>Sau khi test xong, h\u00e3y x\u00f3a file info.php ngay l\u1eadp t\u1ee9c.<\/strong> File n\u00e0y v\u00f4 t\u00ecnh ti\u1ebft l\u1ed9 to\u00e0n b\u1ed9 c\u1ea5u h\u00ecnh PHP, phi\u00ean b\u1ea3n h\u1ec7 th\u1ed1ng, v\u00e0 \u0111\u01b0\u1eddng d\u1eabn server v\u1eadt l\u00fd \u2014 ngu\u1ed3n th\u00f4ng tin c\u1ef1c k\u1ef3 h\u1eefu \u00edch cho b\u1ea5t k\u1ef3 k\u1ebb t\u1ea5n c\u00f4ng n\u00e0o d\u00f2m ng\u00f3 server c\u1ee7a b\u1ea1n.<\/p>\n<pre><code># X\u00f3a file test sau khi verify xong\r\nrm \/var\/www\/html\/info.php<\/code><\/pre>\n<p>Checklist 5 \u0111i\u1ec3m tr\u01b0\u1edbc khi coi setup ho\u00e0n t\u1ea5t th\u00e0nh c\u00f4ng:<\/p>\n<ul>\n<li>Nginx running: <code>systemctl status nginx<\/code> \u2192 <code>active (running)<\/code> \u2713<\/li>\n<li>PHP-FPM running: <code>systemctl status php8.3-fpm<\/code> \u2192 <code>active (running)<\/code> \u2713<\/li>\n<li>MySQL running: <code>systemctl status mysql<\/code> \u2192 <code>active (running)<\/code> \u2713<\/li>\n<li>File phpinfo hi\u1ec3n th\u1ecb c\u00e1c module ch\u00ednh x\u00e1c tr\u00ean tr\u00ecnh duy\u1ec7t \u2713<\/li>\n<li>\u0110\u00e3 thao t\u00e1c x\u00f3a b\u1ecf file info.php ngay sau khi test \u2713<\/li>\n<\/ul>\n<p>Sau khi setup xong n\u1ec1n t\u1ea3ng LEMP, qu\u00e1 tr\u00ecnh ti\u1ebfp theo l\u00e0 ti\u1ebfn h\u00e0nh hardening server \u2014 h\u00e3y tham kh\u1ea3o c\u00e1c <a href=\"https:\/\/interdata.vn\/blog\/bao-mat-vps-linux\/\">ph\u01b0\u01a1ng ph\u00e1p b\u1ea3o m\u1eadt VPS Linux c\u01a1 b\u1ea3n<\/a> tr\u01b0\u1edbc khi ch\u00ednh th\u1ee9c \u0111\u01b0a website v\u00e0o ho\u1ea1t \u0111\u1ed9ng production.<\/p>\n<h2><span class=\"ez-toc-section\" id=\"Xu-Ly-Loi-Thuong-Gap-Khi-Cai-LEMP-Stack\"><\/span>X\u1eed L\u00fd L\u1ed7i Th\u01b0\u1eddng G\u1eb7p Khi C\u00e0i LEMP Stack<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<h3><span class=\"ez-toc-section\" id=\"Tai-sao-truy-cap-IP-VPS-chi-thay-trang-trang-hoac-502-Bad-Gateway\"><\/span>T\u1ea1i sao truy c\u1eadp IP VPS ch\u1ec9 th\u1ea5y trang tr\u1eafng ho\u1eb7c 502 Bad Gateway?<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p>L\u1ed7i 502 Bad Gateway \u0111\u1ed3ng ngh\u0129a v\u1edbi vi\u1ec7c Nginx \u0111\u00e3 nh\u1eadn \u0111\u01b0\u1ee3c request t\u1eeb client nh\u01b0ng kh\u00f4ng th\u1ec3 li\u00ean l\u1ea1c \u0111\u01b0\u1ee3c v\u1edbi PHP-FPM ph\u00eda sau \u2014 th\u01b0\u1eddng xu\u1ea5t ph\u00e1t t\u1eeb 1 trong 2 nguy\u00ean nh\u00e2n c\u1ed1t l\u00f5i: PHP-FPM th\u1ef1c t\u1ebf ch\u01b0a ch\u1ea1y, ho\u1eb7c c\u1ea5u h\u00ecnh socket path trong file config c\u1ee7a Nginx \u0111ang b\u1ecb sai l\u1ec7ch. Ki\u1ec3m tra PHP-FPM tr\u01b0\u1edbc ti\u00ean:<\/p>\n<pre><code>systemctl status php8.3-fpm<\/code><\/pre>\n<p>N\u1ebfu PHP-FPM b\u00e1o tr\u1ea1ng th\u00e1i <code>failed<\/code>, ti\u1ebfn h\u00e0nh kh\u1edfi \u0111\u1ed9ng l\u1ea1i service:<\/p>\n<pre><code>systemctl restart php8.3-fpm<\/code><\/pre>\n<p>N\u1ebfu b\u1ea1n th\u1ea5y PHP-FPM \u0111ang ch\u1ea1y b\u00ecnh th\u01b0\u1eddng m\u00e0 tr\u00ecnh duy\u1ec7t v\u1eabn hi\u1ec3n th\u1ecb 502, h\u00e3y ki\u1ec3m tra l\u1ea1i socket path. Socket file m\u1eb7c \u0111\u1ecbnh c\u1ee7a PHP 8.3 FPM n\u1eb1m \u1edf <code>\/run\/php\/php8.3-fpm.sock<\/code> \u2014 h\u00e3y \u0111\u1ed1i chi\u1ebfu v\u1edbi d\u00f2ng <code>fastcgi_pass<\/code> trong file Nginx config c\u1ee7a b\u1ea1n. Vi\u1ec7c g\u1ecdi sai version (v\u00ed d\u1ee5 file config \u0111ang ghi <code>php8.1-fpm.sock<\/code> nh\u01b0ng th\u1ef1c t\u1ebf server \u0111ang ch\u1ea1y PHP 8.3) l\u00e0 nguy\u00ean nh\u00e2n di\u1ec5n ra r\u1ea5t ph\u1ed5 bi\u1ebfn \u0111\u1ed1i v\u1edbi newbie.<\/p>\n<pre><code># Xem Nginx \u0111ang b\u00e1o l\u1ed7i g\u00ec c\u1ee5 th\u1ec3\r\ntail -f \/var\/log\/nginx\/error.log<\/code><\/pre>\n<p>Tr\u01b0\u1eddng h\u1ee3p trang tr\u1eafng tinh (white page) xu\u1ea5t hi\u1ec7n thay v\u00ec 502 th\u01b0\u1eddng l\u00e0 do g\u1eb7p l\u1ed7i PHP nghi\u00eam tr\u1ecdng \u2014 h\u00e3y b\u1eadt error display t\u1ea1m th\u1eddi \u0111\u1ec3 debug: th\u00eam d\u00f2ng <code>ini_set('display_errors', 1);<\/code> ngay ph\u1ea7n \u0111\u1ea7u file PHP c\u1ee7a b\u1ea1n, quan s\u00e1t tr\u1ef1c ti\u1ebfp th\u00f4ng b\u00e1o l\u1ed7i hi\u1ec3n th\u1ecb, x\u1eed l\u00fd l\u1ed7i v\u00e0 sau \u0111\u00f3 t\u1eaft thi\u1ebft l\u1eadp n\u00e0y \u0111i.<\/p>\n<h3><span class=\"ez-toc-section\" id=\"Tai-sao-MySQL-khong-cho-phep-dang-nhap-sau-khi-cai\"><\/span>T\u1ea1i sao MySQL kh\u00f4ng cho ph\u00e9p \u0111\u0103ng nh\u1eadp sau khi c\u00e0i?<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p>Tr\u00ean n\u1ec1n t\u1ea3ng Ubuntu, m\u1eb7c \u0111\u1ecbnh MySQL s\u1eed d\u1ee5ng plugin <code>auth_socket<\/code> cho t\u00e0i kho\u1ea3n root \u2014 t\u1ee9c l\u00e0 c\u01a1 ch\u1ebf MySQL s\u1ebd ti\u1ebfn h\u00e0nh x\u00e1c th\u1ef1c d\u1ef1a tr\u00ean t\u00e0i kho\u1ea3n user Linux \u0111ang \u0111\u01b0\u1ee3c login tr\u00ean shell, b\u1ea1n ho\u00e0n to\u00e0n kh\u00f4ng c\u1ea7n nh\u1eadp password khi d\u00f9ng c\u00e2u l\u1ec7nh <code>sudo mysql<\/code>. \u0110\u00e2y kh\u00f4ng ph\u1ea3i l\u00e0 m\u1ed9t l\u1ed7i h\u1ec7 th\u1ed1ng, \u0111\u00e2y l\u00e0 c\u01a1 ch\u1ebf b\u1ea3o m\u1eadt ch\u1eb7t ch\u1ebd \u0111\u01b0\u1ee3c thi\u1ebft l\u1eadp m\u1eb7c \u0111\u1ecbnh. N\u1ebfu b\u1ea1n th\u1ef1c s\u1ef1 c\u1ea7n \u0111\u0103ng nh\u1eadp b\u1eb1ng password (v\u00ed d\u1ee5 \u0111\u1ec3 c\u1ea5u h\u00ecnh k\u1ebft n\u1ed1i database t\u1eeb \u1ee9ng d\u1ee5ng PHP b\u00ean th\u1ee9 ba), b\u1ea1n ph\u1ea3i \u0111\u1ed5i thi\u1ebft l\u1eadp sang d\u1ea1ng <code>mysql_native_password<\/code>:<\/p>\n<pre><code># \u0110\u0103ng nh\u1eadp MySQL kh\u00f4ng c\u1ea7n password (d\u00f9ng sudo)\r\nsudo mysql\r\n\r\n# \u0110\u1ed5i auth method c\u1ee7a root\r\nALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'your_new_password';\r\nFLUSH PRIVILEGES;\r\nEXIT;<\/code><\/pre>\n<p>Sau b\u01b0\u1edbc thi\u1ebft l\u1eadp n\u00e0y, b\u1ea1n ho\u00e0n to\u00e0n c\u00f3 th\u1ec3 login b\u1eb1ng l\u1ec7nh <code>mysql -u root -p<\/code> v\u00e0 \u0111i\u1ec1n password v\u00e0o b\u00ecnh th\u01b0\u1eddng. Tuy nhi\u00ean \u1edf m\u00f4i tr\u01b0\u1eddng production th\u1ef1c t\u1ebf, b\u1ea1n ch\u1ec9 n\u00ean t\u1ea1o user \u0111\u1ecbnh danh ri\u00eang bi\u1ec7t cho t\u1eebng \u1ee9ng d\u1ee5ng nh\u1ecf nh\u01b0 \u0111\u00e3 h\u01b0\u1edbng d\u1eabn k\u1ef9 \u1edf tr\u00ean \u2014 \u0111\u1eebng l\u1ea1m d\u1ee5ng s\u1eed d\u1ee5ng root tr\u1ef1c ti\u1ebfp.<\/p>\n<p><!-- CTA BOX --><\/p>\n<div style=\"border-left: 4px solid #0f6cbf; background: #f0f7ff; border-radius: 0 8px 8px 0; padding: 20px 24px; margin: 40px 0; max-width: 100%;\">\n<div style=\"display: flex; align-items: center; margin-bottom: 12px;\"><span style=\"font-size: 22px; margin-right: 10px;\">\ud83d\ude80<\/span><br \/>\n<strong style=\"color: #1a3c6e; font-size: 23px; text-transform: uppercase;\">VPS Gi\u00e1 R\u1ebb Hi\u1ec7u N\u0103ng Cao \u2014 InterData<\/strong><\/div>\n<p style=\"color: #333; font-size: 14px; margin: 0 0 16px 0; line-height: 1.6;\">C\u1ea7n m\u1ed9t VPS Ubuntu \u0111\u1ee7 m\u1ea1nh \u0111\u1ec3 th\u1ef1c h\u00e0nh setup LEMP Stack ngay? InterData cung c\u1ea5p d\u1ecbch v\u1ee5 VPS t\u1ed1c \u0111\u1ed9 cao v\u1edbi \u1ed5 c\u1ee9ng SSD NVMe U.2, c\u00e0i s\u1eb5n Ubuntu 22.04 \/ 24.04, v\u00e0 \u0111\u1eb7c bi\u1ec7t cho ph\u00e9p b\u1ea1n d\u00f9ng th\u1eed tr\u01b0\u1edbc khi thanh to\u00e1n.<\/p>\n<p style=\"color: #555; font-size: 13px; margin: 0 0 18px 0;\"><strong style=\"color: #0f6cbf;\">\u2713<\/strong> SSD NVMe U.2 \u2014 I\/O c\u1ef1c nhanh, \u0111\u00e1p \u1ee9ng tuy\u1ec7t v\u1eddi cho database<br \/>\n<strong style=\"color: #0f6cbf;\">\u2713<\/strong> H\u1ed7 tr\u1ee3 c\u00e0i \u0111\u1eb7t t\u1ef1 \u0111\u1ed9ng h\u1ec7 \u0111i\u1ec1u h\u00e0nh Ubuntu 22.04 v\u00e0 24.04 LTS<br \/>\n<strong style=\"color: #0f6cbf;\">\u2713<\/strong> \u0110\u1ea3m b\u1ea3o backup \u0111\u1ecbnh k\u1ef3 an to\u00e0n, \u0111i k\u00e8m ch\u00ednh s\u00e1ch d\u00f9ng th\u1eed mi\u1ec5n ph\u00ed<\/p>\n<p><a style=\"display: inline-block; background: #0f6cbf; color: #fff; font-size: 14px; font-weight: 600; text-decoration: none; padding: 10px 22px; border-radius: 6px;\" href=\"https:\/\/interdata.vn\/thue-vps\/\">Thu\u00ea VPS Gi\u00e1 R\u1ebb Ngay \u2192<\/a><\/p>\n<\/div>\n<h2><span class=\"ez-toc-section\" id=\"Cau-Hoi-Thuong-Gap-Khi-Cai-LEMP-Stack-Tren-Ubuntu-VPS\"><\/span>C\u00e2u H\u1ecfi Th\u01b0\u1eddng G\u1eb7p Khi C\u00e0i LEMP Stack Tr\u00ean Ubuntu VPS<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<h3><span class=\"ez-toc-section\" id=\"Cai-LEMP-stack-tren-Ubuntu-2404-co-khac-Ubuntu-2204-khong\"><\/span>C\u00e0i LEMP stack tr\u00ean Ubuntu 24.04 c\u00f3 kh\u00e1c Ubuntu 22.04 kh\u00f4ng?<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p>C\u00f3 m\u1ed9t \u0111i\u1ec3m kh\u00e1c bi\u1ec7t ch\u00ednh: Ubuntu 24.04 \u0111\u00e3 t\u00edch h\u1ee3p s\u1eb5n phi\u00ean b\u1ea3n PHP 8.3 trong repository m\u1eb7c \u0111\u1ecbnh c\u1ee7a h\u1ecd, do \u0111\u00f3 b\u1ea1n kh\u00f4ng c\u1ea7n ph\u1ea3i t\u1ed1n c\u00f4ng th\u00eam PPA c\u1ee7a <code>ondrej\/php<\/code>. C\u00f2n l\u1ea1i \u2014 to\u00e0n b\u1ed9 c\u00e1c l\u1ec7nh c\u00e0i \u0111\u1eb7t Nginx, c\u1ea5u h\u00ecnh MySQL, c\u0169ng nh\u01b0 tinh ch\u1ec9nh file server block \u2014 \u0111\u1ec1u tu\u00e2n th\u1ee7 c\u00e1c c\u00e2u l\u1ec7nh gi\u1ed1ng h\u1ec7t nhau. N\u1ebfu b\u1ea1n \u0111ang ch\u1ea1y b\u1ea3n Ubuntu 24.04, ch\u1ec9 c\u1ea7n b\u1ecf qua b\u01b0\u1edbc ch\u1ea1y l\u1ec7nh <code>add-apt-repository ppa:ondrej\/php<\/code> v\u00e0 g\u1ecdi th\u1eb3ng l\u1ec7nh <code>apt install php8.3-fpm<\/code> l\u00e0 \u0111\u01b0\u1ee3c.<\/p>\n<h3><span class=\"ez-toc-section\" id=\"Co-the-cai-nhieu-phien-ban-PHP-cung-luc-tren-mot-VPS-khong\"><\/span>C\u00f3 th\u1ec3 c\u00e0i nhi\u1ec1u phi\u00ean b\u1ea3n PHP c\u00f9ng l\u00fac tr\u00ean m\u1ed9t VPS kh\u00f4ng?<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p>\u0110\u01b0\u1ee3c, v\u00e0 \u0111\u00e2y l\u00e0 t\u00ednh n\u0103ng c\u1ef1c k\u1ef3 h\u1eefu \u00edch khi b\u1ea1n ph\u1ea3i ch\u1ea1y nhi\u1ec1u project c\u00f3 y\u00eau c\u1ea7u t\u01b0\u01a1ng th\u00edch version PHP ho\u00e0n to\u00e0n kh\u00e1c nhau. Sau khi b\u1ea1n th\u00eam kho PPA <code>ondrej\/php<\/code>, h\u00e3y ti\u1ebfn h\u00e0nh ch\u1ea1y l\u1ec7nh <code>apt install php8.1-fpm php8.3-fpm<\/code> \u0111\u1ec3 h\u1ec7 th\u1ed1ng c\u00e0i \u0111\u1eb7t ch\u00fang song song. M\u1ed7i m\u1ed9t phi\u00ean b\u1ea3n s\u1ebd ch\u1ea1y \u0111\u1ed9c l\u1eadp tr\u00ean m\u1ed9t socket ri\u00eang bi\u1ec7t c\u1ee7a n\u00f3 (v\u00ed d\u1ee5 <code>php8.1-fpm.sock<\/code>, <code>php8.3-fpm.sock<\/code>). Vi\u1ec7c ti\u1ebfp theo r\u1ea5t \u0111\u01a1n gi\u1ea3n, trong file Nginx server block c\u1ee7a t\u1eebng website, b\u1ea1n ch\u1ec9 c\u1ea7n tinh ch\u1ec9nh l\u1ea1i m\u1ee5c <code>fastcgi_pass<\/code> ch\u1ec9 th\u1eb3ng v\u1ec1 \u0111\u00fang file socket c\u1ee7a phi\u00ean b\u1ea3n c\u1ea7n d\u00f9ng l\u00e0 xong.<\/p>\n<h3><span class=\"ez-toc-section\" id=\"Sau-khi-cai-LEMP-xong-buoc-tiep-theo-de-chay-WordPress-la-gi\"><\/span>Sau khi c\u00e0i LEMP xong, b\u01b0\u1edbc ti\u1ebfp theo \u0111\u1ec3 ch\u1ea1y WordPress l\u00e0 g\u00ec?<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p>C\u1ea7n l\u00e0m 4 vi\u1ec7c: t\u1ea1o database k\u00e8m user MySQL d\u00e0nh ri\u00eang cho WordPress (ch\u00fang t\u00f4i \u0111\u00e3 h\u01b0\u1edbng d\u1eabn k\u1ef9 \u1edf ph\u1ea7n tr\u00ean), ti\u1ebfn h\u00e0nh t\u1ea3i m\u00e3 ngu\u1ed3n WordPress v\u1ec1 v\u00e0 gi\u1ea3i n\u00e9n th\u1eb3ng v\u00e0o th\u01b0 m\u1ee5c web root, m\u1edf c\u1ea5u h\u00ecnh file <code>wp-config.php<\/code> v\u1edbi \u0111\u00fang th\u00f4ng tin database v\u1eeba t\u1ea1o, v\u00e0 b\u01b0\u1edbc ch\u1ed1t cu\u1ed1i c\u00f9ng l\u00e0 \u0111i\u1ec1u ch\u1ec9nh c\u1ea5u h\u00ecnh Nginx server block cho site WordPress v\u1edbi d\u00f2ng <code>try_files $uri $uri\/ \/index.php?$args<\/code> ngay trong location block. Ph\u1ea7n h\u01b0\u1edbng d\u1eabn c\u00e0i \u0111\u1eb7t chi ti\u1ebft d\u00e0nh cho WordPress s\u1ebd \u0111\u01b0\u1ee3c ch\u00fang t\u00f4i ph\u00e2n t\u00edch trong m\u1ed9t b\u00e0i vi\u1ebft ri\u00eang bi\u1ec7t.<\/p>\n<h3><span class=\"ez-toc-section\" id=\"Tai-sao-nen-dung-PHP-FPM-thay-vi-mod-php-cho-Nginx\"><\/span>T\u1ea1i sao n\u00ean d\u00f9ng PHP-FPM thay v\u00ec mod_php cho Nginx?<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p>Nginx kh\u00f4ng c\u00f3 module h\u1ed7 tr\u1ee3 x\u1eed l\u00fd m\u00e3 PHP n\u1ed9i b\u1ed9 nh\u01b0 c\u00e1ch Apache \u0111ang l\u00e0m v\u1edbi mod_php \u2014 \u0111\u00e2y ch\u00ednh l\u00e0 \u0111i\u1ec3m kh\u00e1c bi\u1ec7t v\u1ec1 m\u1eb7t ki\u1ebfn tr\u00fac c\u01a1 b\u1ea3n c\u1ee7a h\u1ec7 th\u1ed1ng. B\u1ea3n th\u00e2n Nginx ch\u1ec9 ho\u00e0n th\u00e0nh xu\u1ea5t s\u1eafc vai tr\u00f2 l\u00e0m web server, m\u1ecdi y\u00eau c\u1ea7u x\u1eed l\u00fd logic PHP \u0111\u1ec1u ph\u1ea3i \u0111\u01b0\u1ee3c pass tr\u1ef1c ti\u1ebfp sang FPM th\u00f4ng qua chu\u1ea9n giao th\u1ee9c FastCGI. PHP-FPM (FastCGI Process Manager) \u0111\u01b0\u1ee3c thi\u1ebft k\u1ebf ch\u1ea1y \u0111\u1ed9c l\u1eadp ho\u00e0n to\u00e0n nh\u01b0 m\u1ed9t service ri\u00eang bi\u1ec7t, l\u00e0m nhi\u1ec7m v\u1ee5 qu\u1ea3n l\u00fd ch\u1eb7t pool worker process, v\u00e0 th\u1eadm ch\u00ed c\u00f3 th\u1ec3 c\u1ea5u h\u00ecnh linh ho\u1ea1t s\u1ed1 l\u01b0\u1ee3ng worker d\u1ef1a theo m\u1ee9c RAM th\u1ef1c t\u1ebf \u2014 ch\u00ednh ki\u1ebfn tr\u00fac ph\u00e2n t\u00e1ch n\u00e0y th\u1ef1c ch\u1ea5t mang l\u1ea1i kh\u1ea3 n\u0103ng m\u1edf r\u1ed9ng linh ho\u1ea1t h\u01a1n r\u1ea5t nhi\u1ec1u so v\u1edbi d\u00f9ng mod_php nguy\u00ean kh\u1ed1i trong c\u00e1c k\u1ecbch b\u1ea3n ch\u1ecbu t\u1ea3i l\u1edbn.<\/p>\n<h3><span class=\"ez-toc-section\" id=\"Can-mo-port-nao-tren-ufw-firewall-sau-khi-cai-LEMP-stack\"><\/span>C\u1ea7n m\u1edf port n\u00e0o tr\u00ean ufw firewall sau khi c\u00e0i LEMP stack?<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p>T\u1ed1i thi\u1ec3u c\u1ea7n 3 port: <strong>22 (SSH)<\/strong> \u0111\u1ec3 duy tr\u00ec k\u1ebft n\u1ed1i qu\u1ea3n l\u00fd server \u2014 nh\u1edb thi\u1ebft l\u1eadp m\u1edf c\u00e1i n\u00e0y \u0111\u1ea7u ti\u00ean ngay khi chu\u1ea9n b\u1ecb enable ufw n\u1ebfu kh\u00f4ng b\u1ea1n s\u1ebd b\u1ecb h\u1ec7 th\u1ed1ng lock out ra ngo\u00e0i; ti\u1ebfp \u0111\u1ebfn l\u00e0 <strong>80 (HTTP)<\/strong> cho c\u00e1c traffic truy c\u1eadp web th\u00f4ng th\u01b0\u1eddng; v\u00e0 <strong>443 (HTTPS)<\/strong> d\u00e0nh cho l\u00fac setup ch\u1ee9ng ch\u1ec9 SSL an to\u00e0n sau n\u00e0y. L\u1ec7nh g\u1ed9p th\u1ef1c thi nhanh: <code>ufw allow OpenSSH &amp;&amp; ufw allow 'Nginx Full'<\/code>. Profile c\u00f3 s\u1eb5n mang t\u00ean &#8220;Nginx Full&#8221; c\u1ee7a ufw th\u1ef1c t\u1ebf \u0111\u00e3 bao g\u1ed3m t\u1ef1 \u0111\u1ed9ng cho ph\u00e9p k\u1ebft n\u1ed1i c\u1ea3 port 80 v\u00e0 443. B\u1ea1n kh\u00f4ng c\u1ea7n ph\u1ea3i m\u1edf port MySQL (3306) ra b\u00ean ngo\u00e0i tr\u1eeb khi th\u1ef1c s\u1ef1 c\u1ea7n c\u1ea5u h\u00ecnh remote database connection \u2014 duy tr\u00ec tr\u1ea1ng th\u00e1i \u0111\u00f3ng m\u1eb7c \u0111\u1ecbnh lu\u00f4n l\u00e0 ph\u01b0\u01a1ng \u00e1n an to\u00e0n h\u01a1n.<\/p>\n<h2><span class=\"ez-toc-section\" id=\"Ket-Luan\"><\/span>K\u1ebft Lu\u1eadn<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>C\u00e0i \u0111\u1eb7t to\u00e0n b\u1ed9 th\u00e0nh ph\u1ea7n Nginx + PHP + MySQL tr\u00ean h\u1ec7 \u0111i\u1ec1u h\u00e0nh Ubuntu VPS s\u1ebd kh\u00f4ng g\u1eb7p v\u1ea5n \u0111\u1ec1 ph\u1ee9c t\u1ea1p n\u1ebfu b\u1ea1n ki\u00ean nh\u1eabn l\u00e0m \u0111\u00fang theo th\u1ee9 t\u1ef1: thao t\u00e1c Nginx tr\u01b0\u1edbc ti\u00ean, setup PHP-FPM sau \u0111\u00f3, c\u1ea5u h\u00ecnh MySQL cu\u1ed1i c\u00f9ng, r\u1ed3i m\u1edbi ti\u1ebfn h\u00e0nh \u0111i s\u00e2u c\u1ea5u h\u00ecnh server block \u0111\u1ec3 k\u1ebft n\u1ed1i c\u1ea3 3 th\u00e0nh ph\u1ea7n r\u1eddi r\u1ea1c n\u00e0y l\u1ea1i v\u1edbi nhau.<\/p>\n<p>Hai \u0111i\u1ec3m ch\u00ed t\u1eed m\u00e0 ng\u01b0\u1eddi m\u1edbi c\u1ea5u h\u00ecnh hay v\u00f4 \u00fd b\u1ecf qua nh\u1ea5t ch\u00ednh l\u00e0 thao t\u00e1c verify c\u1ea9n th\u1eadn t\u1eebng service b\u1eb1ng l\u1ec7nh <code>systemctl status<\/code> sau khi c\u00e0i xong, v\u00e0 b\u1eaft bu\u1ed9c ph\u1ea3i x\u00f3a b\u1ecf file <code>info.php<\/code> ngay sau khi test. N\u1ec1n t\u1ea3ng LEMP stack c\u1ea5u h\u00ecnh xong ch\u1ec9 l\u00e0 ph\u1ea7n l\u00f5i \u2014 b\u01b0\u1edbc ti\u1ebfp theo b\u1ea1n c\u1ea7n ti\u1ebfn h\u00e0nh hardening server k\u1ef9 l\u01b0\u1ee1ng tr\u01b0\u1edbc khi quy\u1ebft \u0111\u1ecbnh \u0111\u01b0a website l\u00ean production th\u1ef1c t\u1ebf.<\/p>\n<p>\u0110\u00e2y c\u0169ng l\u00e0 n\u1ed9i dung n\u1eb1m trong chu\u1ed7i <a href=\"https:\/\/interdata.vn\/blog\/huong-dan-su-dung-vps\/\" target=\"_blank\" rel=\"noopener\">h\u01b0\u1edbng d\u1eabn s\u1eed d\u1ee5ng VPS t\u1eeb A\u2013Z<\/a> d\u00e0nh cho nh\u1eefng qu\u1ea3n tr\u1ecb vi\u00ean m\u1edbi b\u1eaft \u0111\u1ea7u. N\u1ebfu b\u1ea1n ch\u01b0a k\u1ecbp trang b\u1ecb VPS \u0111\u1ec3 th\u1ef1c h\u00e0nh, h\u00e3y xem x\u00e9t c\u00e1c g\u00f3i d\u1ecbch v\u1ee5 <strong><a href=\"https:\/\/interdata.vn\/thue-vps\/#pricing\" target=\"_blank\" rel=\"noopener\">VPS gi\u00e1 r\u1ebb t\u1ea1i InterData<\/a><\/strong> \u2014 n\u1ec1n t\u1ea3ng chuy\u00ean nghi\u1ec7p cho ph\u00e9p b\u1ea1n s\u1eed d\u1ee5ng tr\u1ea3i nghi\u1ec7m tr\u01b0\u1edbc khi thanh to\u00e1n.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>T\u00f3m t\u1eaft nhanh: LEMP stack l\u00e0 b\u1ed9 ph\u1ea7n m\u1ec1m g\u1ed3m Linux, Nginx, MySQL (ho\u1eb7c MariaDB) v\u00e0 PHP \u2014 n\u1ec1n t\u1ea3ng \u0111\u1ec3 ch\u1ea1y website \u0111\u1ed9ng tr\u00ean VPS. \u0110\u1ec3 c\u00e0i LEMP stack tr\u00ean Ubuntu VPS, b\u1ea1n th\u1ef1c hi\u1ec7n l\u1ea7n l\u01b0\u1ee3t: apt install nginx \u2192 c\u00e0i PHP-FPM k\u00e8m extension c\u1ea7n thi\u1ebft \u2192 c\u00e0i MySQL ho\u1eb7c MariaDB \u2192 c\u1ea5u<\/p>\n","protected":false},"author":2,"featured_media":40234,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[49],"tags":[],"class_list":["post-40233","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-vps"],"_links":{"self":[{"href":"https:\/\/interdata.vn\/blog\/wp-json\/wp\/v2\/posts\/40233","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/interdata.vn\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/interdata.vn\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/interdata.vn\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/interdata.vn\/blog\/wp-json\/wp\/v2\/comments?post=40233"}],"version-history":[{"count":5,"href":"https:\/\/interdata.vn\/blog\/wp-json\/wp\/v2\/posts\/40233\/revisions"}],"predecessor-version":[{"id":41171,"href":"https:\/\/interdata.vn\/blog\/wp-json\/wp\/v2\/posts\/40233\/revisions\/41171"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/interdata.vn\/blog\/wp-json\/wp\/v2\/media\/40234"}],"wp:attachment":[{"href":"https:\/\/interdata.vn\/blog\/wp-json\/wp\/v2\/media?parent=40233"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/interdata.vn\/blog\/wp-json\/wp\/v2\/categories?post=40233"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/interdata.vn\/blog\/wp-json\/wp\/v2\/tags?post=40233"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}