step1:sudo vi /etc/apache2/ports.conf 修改监听端口以及主机端口为8080
NameVirtualHost *:8080
Listen 8080
step2: sudo vi /etc/apache2/sites-available/default 只要修改virtualHost的端口即可:
<VirtualHost *:8080>
step3:重启apache2
sudo service apache2 stop
sudo service apache2 start