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修改站点目录以及添加站点目录
最新推荐文章于 2024-08-21 04:29:37 发布