Loading...
Loading...
Deploy mã nguồn website lên gói hosting cPanel qua API — static site, PHP+MySQL, WordPress trọn gói, Node.js (Passenger), và clone Git. Upload/giải nén archive, di chuyển file, ghi cấu hình. Dùng khi người dùng cần deploy/cài đặt website hoặc ứng dụng (WordPress, PHP, static, Node.js, Laravel) lên hosting cPanel, upload mã nguồn, hoặc clone repo Git về hosting.
npx skill4agent add azdigi-official/hosting_ai_skills cpanel-deploy| Lệnh | Mô tả |
|---|---|
| Upload 1 file local lên server (multipart) |
| Giải nén zip/tar trên server (API2 fileop) |
| Di chuyển/đổi tên file/thư mục |
| Ghi nội dung 1 file text (vd cấu hình) |
| Tạo thư mục |
| Xóa file/thư mục (engine chặn nếu thiếu xác nhận; chạy lại kèm |
| Đổi quyền file (octal 3-4 chữ số, vd 644/0755; cần |
| Đọc lại để kiểm tra |
public_htmlpublic_html/blogcpanel deploy:wp <docroot> <dbname> <dbuser> <dbpass> [table_prefix]
# Ví dụ: deploy vào document root chính
cpanel deploy:wp public_html wpblog wpuser 'M@tKhau#Manh2026'wordpress.org/latest.zip<docroot>wordpress/*<docroot><user>_wp-config.phpdeploy:static# nén & deploy cả thư mục
cpanel deploy:static ./dist public_html/static
# hoặc deploy 1 file zip có sẵn
cpanel deploy:static ./build.zip public_html/app# 1. (tùy chọn) tạo subdomain cho app
cpanel subdomain:add php thachtestvibe.dev
# 2. tạo database
cpanel db:create phpapp
cpanel db:user-create phpuser '<mật khẩu mạnh>'
cpanel db:grant phpuser phpapp
# 3. deploy mã nguồn (KHÔNG kèm file secret)
cpanel deploy:static ./myphpapp public_html/php
# 4. ghi file config chứa credential TRỰC TIẾP trên server (không nằm trong zip)
cpanel file:save public_html/php config.php ./local-config.php<user>_phpapplocalhostcomposerartisan# === LÀM LOCAL ===
# 1. Tạo app + build vendor khớp PHP server (vd server PHP 8.3 → platform 8.3)
composer create-project laravel/laravel myapp # dùng bản Laravel còn được hỗ trợ
cd myapp
composer config platform.php 8.3.0
composer update --no-dev --optimize-autoloader # vendor gọn, đúng PHP target
# 2. DÙNG SQLITE: pre-migrate LOCAL (khỏi chạy artisan migrate trên server)
touch database/database.sqlite
php artisan migrate --force
php artisan optimize:clear # tránh cache path local
cd ..
# === DEPLOY (1 lệnh) ===
cpanel deploy:laravel ./myapp public_html/myapp https://app.example.comdeploy:laravelAPP_KEY.env.env# Trỏ document root vào public/ + đặt PHP version cho vhost
cpanel subdomain:add app example.com public_html/myapp/public
cpanel uapi LangPHP php_set_vhost_versions vhost=app.example.com version=alt-php83composer config platform.phpdatabase/database.sqlitedb:*.envfile:save# path tương đối tự resolve thành tuyệt đối; tên repo tự suy từ basename
cpanel git:clone https://github.com/user/repo.git myrepo
cpanel git:list # xem repo + available_branchesfile:readlist_files# 1. subdomain làm Application URL
cpanel subdomain:add node thachtestvibe.dev
# 2. đưa code vào app root (KHÁC docroot web; vd thư mục 'nodeapp')
cpanel deploy:static ./nodeapp nodeapp
# 3. đăng ký app (app_root, domain, app_name)
cpanel node:create nodeapp node.thachtestvibe.dev mynode app.js production
cpanel node:listGiới hạn không-SSH: Passenger không chạyqua API. Hoặc dùng app zero-dependency (chỉ module built-in của Node), hoặc bundle sẵnnpm installvào zip. App nghe quanode_modules— Passenger tự hijack. Mỗi domain chỉ gắn được một app.http.createServer().listen(process.env.PORT||3000)
cpanel file:upload ./myapp.zip public_html
cpanel file:extract public_html/myapp.zip public_html
cpanel file:save public_html .env ./local.env# 1. File đã vào đúng chỗ
cpanel uapi Fileman list_files dir=public_html | jq -r '.data[].file'
# 2. wp-config.php đúng credential
cpanel file:read public_html wp-config.php | jq -r .data.content
# 3. Database tồn tại
cpanel db:listhttps://<server-host>/~<cpaneluser>/public_htmlhttps://<server-host>/~<cpaneluser>/<subdir>/public_html/*enabled=1https://<domain>/public_htmlphp_set_vhost_versionsfileopdestfilesdestfiles="."fullpathlist_filesindex.htmlindex.phpindex.htmldeploy:wpindex.html.default-bakdeploy:wpcpanel-databaseVersionControl::createrepository_rootsource_repository{"url":"..."}namegit:clonePassengerAppsregister_applicationdomainnpm installnode_modulespublic_htmldeploy:wpcpanel-databasecpanel-domaincpanel-debug