VPS WINDOWS - THIẾT LẬP CHẠY NHIỀU WEBSITE TRÊN XAMPP

VPS WINDOWS - THIẾT LẬP CHẠY NHIỀU WEBSITE TRÊN XAMPP

Việc dùng VPS chạy Xampp luôn phổ biến. Tuy nhiên thông thường là chạy 1 website tại VPS đó.Dưới đây là hướng dẫn thiết lập chạy nhiều website trên Server hoặc VPS sử dụng xampp và windows.

Đầu tiên, bạn cần xác định nơi lưu code của website, hiện tại mình lấy thư mục: D:\Website làm nơi lưu dữ liệu

Bạn cần chạy 03 website ví dụ như:

Xampp web server

thietke.marketcode.net
webapp.marketcode.net
chuyenghiep.marketcode.net

Domain Web

Và nơi lưu dữ liệu sẽ là:

D:\web\thietke.marketcode.net
D:\web\webapp.marketcode.net
D:\web\chuyenghiep.marketcode.net

Nơi lưu trữ

Giả sửa thư mục cài đặt Xampp là D:\xampp (Tùy vào thư mục mà ta cài đặt)

Chúng ta cần sửa file này: D:\xampp\apache\conf\extra\httpd-vhosts.conf

và thêm vào giá đoạn sau

Lưu ý: nhớ đọc code hiện tại, nếu có trùng thì xóa đi, hoặc cứ thêm vào cuối của file http-vhosts.conf, nếu là file mặc định có thể xóa hết đi, chỉ quan tâm tới dòng nào không có dấu #, nếu dòng nào có dấu # ở trước thì có thể xóa được, dấu # biểu thị là chưa có hiệu lực.

NameVirtualHost *:80

<VirtualHost *:80>
ServerName localhost
DocumentRoot D:/xampp/htdocs
</VirtualHost>

<Directory "D:/Website/">
Options Indexes FollowSymLinks MultiViews ExecCGI
AllowOverride All
Order allow,deny
Allow from all
</Directory>
<VirtualHost *:80>
ServerName   thietke.marketcode.net
ServerAlias thietke.marketcode.net
DocumentRoot D:/Website/thietke.marketcode.net
</VirtualHost>

<VirtualHost *:80>
ServerName   thietke.marketcode.net
ServerAlias thietke.marketcode.net
DocumentRoot D:/Website/web1.powernet.vn
</VirtualHost>

<VirtualHost *:80>
ServerName   thietke.marketcode.net
ServerAlias thietke.marketcode.net
DocumentRoot D:/Website/thietke.marketcode.net
</VirtualHost>

Restat lại Apache và nhớ trỏ những tên miền đó về IP của Server hay VPS.

Chúc bạn thành công

Comments (0)
Login or create account to leave comments