RHEL 6 LAMP(一)(3)
# the following line instead:
#
#UserDir public_html #用户的默认页面的目录
</IfModule>
修改为
<IfModule mod_userdir.c>
#
# UserDir is disabled by default since it can confirm the presence
# of a username on the system (depending on home directory
# permissions).
#
UserDir disabled root
#
# To enable requests to /~user/ to serve the user's public_html
# directory, remove the "UserDir disabled" line above, and uncomment
# the following line instead:
#
UserDir public_html
</IfModule>
去掉下列内容前面的#号,并在Indexes前面加“-”号
<Directory /home/*/public_html>
AllowOverride FileInfo AuthConfig Limit
Options MultiViews -Indexes SymLinksIfOwnerMatch IncludesNoExec
<Limit GET POST OPTIONS>
Order allow,deny
Allow from all
</Limit>
<LimitExcept GET POST OPTIONS>
Order deny,allow
Deny from all
</LimitExcept>
</Directory>
b、添加用户,并建立个人主页的目录
adduser test #添加用户
cd /home/test
mkdir public_html #在用户目录里面建立个人主页使用的目录
chown test.test public_html #配置个人主页使用的目录的权限
chmod o+x /home/test #给用户主目录添加其他用户列出权限(不加就打不开)
cd /home/test/public_html
echo "test" > index.html
c、重启服务并测试
service httpd restart
浏览器输入http://ip/~test测试
--------------------------------------------------------------------
基于名称的虚拟主机(重点)
1、做DNS
vi /etc/named.conf
改3个any
vi /etc/named.rfc1912.zones
添加
zone "amao.com" {
type master;
file "amao.com.hosts";
};
-----------------
cd /var/named/
cp named.localhost amao.com.hosts
vi amao.com.hosts
添加
www IN A 你的web服务器的ip
---------
相关新闻>>
- 发表评论
-
- 最新评论 更多>>