apache基础安全设置

1、禁止用户访问网站目录

root@ubuntu:~# vi /etc/apache2/apache2.conf

找到标红文字,去掉 Indexes 即可

<Directory />
    Options FollowSymLinks
    AllowOverride None
    Require all denied
</Directory>

<Directory /usr/share>
    AllowOverride None
    Require all granted
</Directory>

<Directory /var/www/>
    #Options Indexes FollowSymLinks
    Options FollowSymLinks

    AllowOverride None
    Require all granted
</Directory>

#<Directory /srv/>
#    Options Indexes FollowSymLinks
#    AllowOverride None
#    Require all granted
#</Directory>
 

2、隐藏apache报错信息 

2d0ac091925353332e714865e61688bf5fa.jpg

在ubuntu19.04安装的apache中,没有找到关于ServerSignature 和ServerTokens 的信息,所以在配置文件中最后加入这两行即可。

ServerSignature Off
ServerTokens Prod

保存退出,重启apache即刻生效

9ba316016a8d7ac3a2131dd114056bb25b2.jpg

猜你喜欢

转载自blog.csdn.net/qq_38157006/article/details/89952562