说明:
当一个网站目录特别长时,例:http://www.tarena.com/china/hebei/bbs,我们可以给它起个别名来代替这个长的名字。
步骤:
1. 搭建Apache Http网站服务平台
yum -y install httpd* (默认站点目录/var/www/html)
- 创建测试站点
[root@localhost ~]# mkdir -p /var/www/html/china/hebei/bbs
[root@localhost ~]#vim /var/www/html/china/hebei/bbs /index.html
<html>
<head><title>This is a Alias test Page!!!</title>
<body>
<h1>This is a bbs Bie Ming test Page!!!</h1>
</body>
</head>
</html> - 修改主配置文件
[root@localhost ~]# vim /etc/httpd/conf/httpd.conf
Alias /bbs "/var/www/html/china/hebei/bbs" //在配置文件中添加此语句 - 启动服务测试
[root@ser1 ~]# service httpd restart
http://www.tarena.com/china/hebei/bbs
http://www.tarena.com/bbs
转载于:https://blog.51cto.com/zhangguangjun/2053971