apache2 -v
Server version: Apache/2.4.7 (Ubuntu)
1.修改站点根目录
vim /etc/apache2/sites-enabled/000-default.conf
DocumentRoot /mnt/test/
......
vim /etc/apache2/apache2.conf
<Directory /mnt/test/>
Options Indexes FollowSymLinks //Options FollowSymLinks改成这样就是禁止显示目录
AllowOverride None
Require all granted
</Directory>
service apache2 restart
2. 添加站点根目录
vim /etc/apache2/ports.conf
添加:
Listen 8081
......
vim /etc/apache2/sites-enabled/000-default.conf
仿造复制:
<VirtualHost *:8081>
DocumentRoot /home/
...
</VirtualHost>
vim /etc/apache2/apache2.conf
<Directory /home/>
Options Indexes FollowSymLinks
AllowOverride None
Require all granted
</Directory>
service apache2 restart
3.测试
浏览器访问http://xx.xx.xx.xx和http://xx.xx.xx.xx:8081都可以访问到对应的目录
注:错误提示中设置不显示系统以及版本信息等
vim /etc/apache2/con-enabled/security.conf
ServerTokens Prod
ServerSignature Off
......
apache修改站点目录以及添加站点目录
最新推荐文章于 2021-07-24 22:04:07 发布
本文介绍如何使用Apache2配置网站根目录及添加站点根目录的方法,包括修改默认站点配置文件、重启服务等内容,并提供了隐藏服务器版本信息的具体步骤。
1万+

被折叠的 条评论
为什么被折叠?



