apache2 ubuntu18.04 配置虚拟端口
修改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