因为工作的需要,经常要调试不同的站点,apache配置不同的端口访问不同的站点很方便:
eg:
sudo /etc/apach2/apache2.conf
再最后加入:
#端口
Listen 127.0.0.1:82
#配置虚拟目录
NameVirtualHost 127.0.0.1:端口号
<VirtualHost 127.0.0.1:端口号>
ServerName 127.0.0.1:端口号
DocumentRoot "路径"
<Directory "路径">
#访问权限
order allow,deny
allow from all
</Directory>
</VirtualHost>
补充:千万别忘记 sudo /etc/init.d/apache2 restart