1。關于出錯頁面的小結
Include conf.d/*.conf 所有在conf.d下的以.conf結尾的文件作為補充配置文件。
在el3中有conf.d/welcome.conf
內容
<LocationMatch "^/$>
Options -Indexes
ErrorDocument 403 /error/noindex.html
</LocationMatch>
作用是當 目錄下無index文件時,自動轉到/error/noindex.html中
而在rh9中 是直接寫到httpd.conf中,包含這些內容。
2。
以下行作用:是對所有為定義的目錄做一個 總體定義
<Directory /> 總控制,定義了連接。
Options FollowSymLinks
AllowOverride None
</Directory>
3。
注意:別名
Alias /error/ "/var/www/error/"
/error/最后的“/”一定要有,而虛擬主機,或者目錄設置可以不要
4。
常用出錯頁面
ErrorDocument 400 /error/HTTP_BAD_REQUEST.html.var
ErrorDocument 401 /error/HTTP_UNAUTHORIZED.html.var 需要認證
ErrorDocument 403 /error/HTTP_FORBIDDEN.html.var 訪問被拒絕
ErrorDocument 404 /error/HTTP_NOT_FOUND.html.var 頁面找不到
ErrorDocument 405 /error/HTTP_METHOD_NOT_ALLOWED.html.var
ErrorDocument 408 /error/HTTP_REQUEST_TIME_OUT.html.var
ErrorDocument 410 /error/HTTP_GONE.html.var
ErrorDocument 411 /error/HTTP_LENGTH_REQUIRED.html.var
ErrorDocument 412 /error/HTTP_PRECONDITION_FAILED.html.var
ErrorDocument 413 /error/HTTP_REQUEST_ENTITY_TOO_LARGE.html.var
ErrorDocument 414 /error/HTTP_REQUEST_URI_TOO_LARGE.html.var
ErrorDocument 415 /error/HTTP_SERVICE_UNAVAILABLE.html.var
ErrorDocument 500 /error/HTTP_INTERNAL_SERVER_ERROR.html.var
ErrorDocument 501 /error/HTTP_NOT_IMPLEMENTED.html.var
ErrorDocument 502 /error/HTTP_BAD_GATEWAY.html.var
ErrorDocument 503 /error/HTTP_SERVICE_UNAVAILABLE.html.var
ErrorDocument 506 /error/HTTP_VARIANT_ALSO_VARIES.html.var、
5。apache關聯的主要目錄
cgi-bin(cgi程序保存的目錄)
error (出錯文件保存的目錄)
html (正常網站頁面內容)
icons (不詳??!都是圖片) 支持index 不不知道??!
manual (幫助手冊目錄) 支持index
6。
deny from 192.168.100.
deny from 192.168.100
deny from 192.168.100.101/24
都可以
域名用.example.com
7。用戶登陸認證
directory中加
AllowOverride AuthConfig
在限制的目錄下
.htaclearcase/" target="_blank" >ccess 這個名字固定 千萬注意不要寫錯
寫入
AuthName "Auth service"
AuthType basic
AuthUserFile /etc/httpd/conf/.htpasswd 這個名字和位置都不固定,
require valid-user
用htpasswd -c /etc/httpd/conf/.htpasswd 用戶名
8。關于目錄的進一步理解
目錄可以設置多個,如:
<VirtualHost 192.168.100.103:80>
ServerAdmin root@www1.example.com
DocumentRoot /var/www1/html
<Directory /var/www1/html>
Options Followsymlinks
Order allow,deny
allow from 192.168.100.102
</Directory>
<Directory /var/www1/html/tools> 不同
Options Indexes Followsymlinks
</Directory>
ServerName www1.example.com
ErrorLog logs/www1.example.com-error_log
CustomLog logs/www1.example.com-access_log common
</VirtualHost>