默认主页
DocumentRoot "/var/www/html":规定WWW服务器主页放置的目录
<Directory />
Options FollowSymLinks
AllowOverride None
</Directory>:针对/设定的
因为允许浏览,所以需要针对可被浏览的目录进行权限的相关限定
<Directory "/var/www/html">
Options Indexes FollowSymLinks (动作)
AllowOverride None(是否允许额外配置文件 .htaccess 的权限重写)
Order allow,deny
Allow from all
</Directory>
DirectoryIndex index.html index.html.var :预设的首页
Apache 进阶设定
启动个人用户网站
<IfModule mod_userdir.c>
UserDir disable 将此行注销掉
#UserDir public_html 启用这行
</IfModule>
Apache 默认的个人首页是放置在家目录下的 public_html/ 目录下
如果没有这个public_html目录则创建,记得给目录权限755;
访问时通过http://你的主机名/~username/
网页错误显示信息通知
#ErrorDocument 404 /missing.html
#ErrorDocument 404 "/cgi-bin/missing_handler.pl"
/missing.html 必需要放置在你的/var/www/html目录下
设置浏览器访问权限
<Directory "/var/www/html">
Options FollowSymLinks
AllowOverride None
Order allow,deny 以allow为优先处理,但没有写入规则的则默认为deny
allow from all
deny from 192.168.1.1
deny from .tony9.cn
</Directory>
对主页目录下的文件进行权限设定,建议将 allow 的规则写在最上方,拒绝192.168.1.1(不过一般都是限定公网IP)和tony9.cn主机
主机状态说明网页
ExtendedStatus On
<Location /server-status>
SetHandler server-status
Order deny,allow
Deny from all 以deny优先处理,但没有写入规则的则默认为allow
Allow from 222.73.202.226
Allow from 127.0.0.1
</Location>