Một cách cài đặt và cấu hình apache2 virtual host trên Debian/Linux

Sửa file apache2.cfg
NameVirtualHost *:80

Tạo file cho site mới, ví dụ pcf

ServerAdmin webmaster@dummy-host2.example.com
DocumentRoot /home/khanhtq/test/cmsms
ServerName dev.cmsms.local
ErrorLog /var/log/apache2/cmsms-error_log
CustomLog /var/log/apache2/cmsms-access_log common


Enable site
#a2ensite pcf

Disable site
#a2dissite pcf

Enable module
#a2enmod userdir

Tiện ích:
Kiểm tra lỗi cú pháp
#apache2 -t