vi

Hướng Dẫn Chạy Website Trên VPS Offshore

Chạy website trên VPS offshore mang lại sự kiểm soát hoàn toàn mà shared hosting không thể cung cấp. Bạn tự cài đặt web server, quản lý SSL, cấu hình bảo mật, và mở rộng tài nguyên khi cần. Hướng dẫn này chỉ bạn từng bước để có website hoạt động trên VPS Linux từ đầu đến cuối.

Need this done for your project?

We implement, you ship. Async, documented, done in days.

Start a Brief

Bước 1: Cài Đặt Web Server Nginx

Sau khi đăng nhập SSH vào VPS, cập nhật hệ thống và cài Nginx:

apt update && apt upgrade -y
apt install nginx -y
systemctl enable nginx
systemctl start nginx

Kiểm tra Nginx chạy đúng bằng cách truy cập địa chỉ IP của VPS từ trình duyệt. Bạn sẽ thấy trang mặc định "Welcome to nginx".

Tạo thư mục cho website của bạn:
mkdir -p /var/www/yourdomain.com/public_html
chown -R www-data:www-data /var/www/yourdomain.com

Tạo file cấu hình Nginx cho domain:
nano /etc/nginx/sites-available/yourdomain.com

Bước 2: Cấu Hình Domain và SSL

Trỏ domain về IP của VPS trong DNS settings của domain registrar. Sau đó cài SSL miễn phí với Let's Encrypt:

apt install certbot python3-certbot-nginx -y
certbot --nginx -d yourdomain.com -d www.yourdomain.com

Certbot sẽ tự động cấu hình Nginx để dùng HTTPS và tạo cronjob tự động gia hạn certificate. Website của bạn sẽ có HTTPS trong vài phút.

Kiểm tra cấu hình Nginx và reload:
nginx -t
systemctl reload nginx

Certbot tự gia hạn certificate mỗi 90 ngày. Bạn có thể test quá trình gia hạn bằng:
certbot renew --dry-run

Bước 3: Cài WordPress (Tùy Chọn)

Nếu bạn muốn dùng WordPress, cần cài thêm PHP và MySQL/MariaDB:

apt install php8.1 php8.1-fpm php8.1-mysql php8.1-xml php8.1-curl php8.1-gd mariadb-server -y

Tạo database cho WordPress:
mysql -u root -p
CREATE DATABASE wordpress_db;
CREATE USER 'wp_user'@'localhost' IDENTIFIED BY 'mat_khau_manh';
GRANT ALL PRIVILEGES ON wordpress_db.* TO 'wp_user'@'localhost';
FLUSH PRIVILEGES;
EXIT;

Tải và cài WordPress:
cd /var/www/yourdomain.com/public_html
wget https://wordpress.org/latest.tar.gz
tar -xzf latest.tar.gz --strip-components=1
chown -R www-data:www-data /var/www/yourdomain.com

Truy cập domain trên trình duyệt để hoàn thành cài đặt WordPress qua giao diện web.

Bước 4: Tối Ưu Hóa Hiệu Suất và Bảo Mật

Một số cấu hình quan trọng sau khi website chạy:

Firewall (UFW):
ufw allow 22/tcp
ufw allow 80/tcp
ufw allow 443/tcp
ufw enable

Fail2ban chống brute force:
apt install fail2ban -y
systemctl enable fail2ban

Backup tự động: Cài đặt cron job backup database và files mỗi ngày. Lưu backup ra server khác hoặc cloud storage.

Monitoring: Cài netdata hoặc Prometheus để monitor CPU, RAM, disk, và network của server. Nhận cảnh báo khi tài nguyên gần hết hoặc server có vấn đề.

VPS offshore AnubizHost cho phép bạn mở mọi port cần thiết và cài bất kỳ phần mềm nào - không bị giới hạn như shared hosting.

Why Anubiz Host

100% async — no calls, no meetings
Delivered in days, not weeks
Full documentation included
Production-grade from day one
Security-first approach
Post-delivery support included

Ready to get started?

Skip the research. Tell us what you need, and we'll scope it, implement it, and hand it back — fully documented and production-ready.

Anubiz Chat AI

Online