如果我们利用了LINUX系统架设了一台WEB服务器,我们不仅可以存放公司的主页,而且还可以为公司的每一个员工提供一块个人主页的空间。
这样,它就拥有了一个用户主目录"/home/用户帐号名"。
addusr 用户帐号名
passwd 用户帐号名
在用户主目录下建立一个目录"public_html",然后为其设置相应的权限。
cd ~用户帐号名
mkdir public_html
chmod 755 public_html
确认在/etc/httpd/conf/httpd.conf文件中的UserDir命令设置的是public_html目录。
#
# UserDir is disabled by default since it can confirm the presence
# of a username on the system (depending on home directory
# permissions).
#基于安全考虑,禁止root用户使用自己的个人站点
UserDir disable root
#
# To enable requests to /~user/ to serve the user's public_html
# directory, remove the "UserDir disable" line above, and uncomment
# the following line instead:
# 配置每个用户的web站点目录的设置,去掉“#”
UserDir public_html
#
# Control access to UserDir directories. The following is an example
# for a site where these directories are restricted to read-only.
#设置每个用户web站点目录的访问权限,将下面配置行前的“#”去掉
AllowOverride FileInfo AuthConfig Limit
Options MultiViews Indexes SymLinksIfOwnerMatch IncludesNoExec
Order allow,deny
Allow from all
Order deny,allow
Deny from all
UserDir指令允许用户有一个单独的空间给他们自己的web文档。举例说明:如果 /home/bob/public_html存在而且UserDir被设置为Public_html ,那么对http://servers /~bob/的访问将读取来自/home/bob/public_html/内的文档。
让员工将自己的个人主页上传到自己用户主目录下的public_html目录中。现在就可以使用"http://www.company.com/~用户帐号名"来访问员工的个人主页了。
AddType application/x-httpd-php.phtml
AddType text/html.htm
当浏览从一个web服务器接收来的文件时,它也接收相关的MIME类型。AddType指令允许一个web服务器去聪明地在文件名扩展基础之上补充MIME类型。
DirectoryIndex index.html default.htm
DirectoryIndex指令定义文件名,此文件名被考虑索引一个目录。如果一个URL指定一个目录优于一个名称文件,那么为了索引文件列表中之一的文件此目录将被搜索。支持多个索引文件名,优先权赋予在DirectooyIndex列表中第一个出现的文件名上。
留言与评论(共有 0 条评论) “” |