修改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端口

apache2 ubuntu18.04 配置虚拟端口

 

000-default.conf中,找类似下图的地方

apache2 ubuntu18.04 配置虚拟端口

 

复制一个这样的东西出来,
把 80改成之前设好的监听端口66
把 /var/www改成之前设好的需要访问的目录/var/www/html

最后重启apache即可
ubuntu下的开始,停止,重启
/etc/init.d/apache2 start
/etc/init.d/apache2 stop
/etc/init.d/apache2 restart

相关文章:

  • 2021-09-27
  • 2021-08-06
  • 2021-11-08
  • 2021-10-16
  • 2021-12-06
  • 2021-07-14
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-06-08
  • 2021-08-06
  • 2021-09-03
相关资源
相似解决方案