修改3個文件
/etc/apache2/apache2.conf
/etc/apache2/ports.conf
/etc/apache2/sites-available/000-default.conf
apache2.conf中,新增如下代碼
<Directory /var/www/html>
Options Indexes FollowSymLinks
AllowOverride None
Require all granted
</Directory>
復制一個這樣的東西出來,修改一下/var/www/html/改成你想映射的虛擬目錄
ports.conf中
把需要監聽的端口寫成這樣的形式就可以了,我這里監聽66端口
000-default.conf中,找類似下圖的地方
復制一個這樣的東西出來,
把 80改成之前設好的監聽端口66
把 /var/www改成之前設好的需要訪問的目錄/var/www/html
最后重啟apache即可
ubuntu下的開始,停止,重啟
/etc/init.d/apache2 start
/etc/init.d/apache2 stop
/etc/init.d/apache2 restart