In the site configuration, the general different directories correspond to different websites, when we want to set a different site directory for the same site, we need to use the alias function in httpd.
Create an alias directory and file
[[email protected] bieming]# mkdir/bieming[[email protected] bieming]# cd/bieming[[email protected] bieming]# Pwd/biemi Ng[[email protected] bieming]# echo "This is a Alias page" >/bieming/in.html[[email protected] bieming]# tree. '--In.h Tml
Second, modify the/etc/httpd/conf/httpd.conf configuration file
alias/bl/"/bieming/" <directory "/bieming/" >options Indexes multiviews followsymlinksallowoverride NoneOrder Allow,denyallow from All</directory> ————————————————————
Check syntax for errors:
# service-t
Overloading the httpd configuration file
#service httpd Reload
Third, visit
1, Access HTTP://192.168.65.80/BL directory found 404 interface and then look at the error log as follows
View/var/log/httpd/error_log
[Sat 28 23:55:33 2015] [ERROR] [Client 192.168.65.1] File does not exist:/VHOST/WWW/HTML/BL//visited or Web site root directory
2. Access to specific files in aliases in.html
Http://192.168.65.80/bl/in.html
650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M02/6C/27/wKioL1VBFhGhI5hEAAFDHgQjM-8157.jpg "title=" 111. JPG "alt=" wkiol1vbfhghi5heaafdhgqjm-8157.jpg "/>
650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M01/6C/2B/wKiom1VBGF6C-eCkAAFDHgQjM-8043.jpg "title=" 111. JPG "alt=" wkiom1vbgf6c-eckaafdhgqjm-8043.jpg "/>
[[email protected] bieming]# tail-2/var/log/httpd/access_log 192.168.65.1--[28/mar/2015:23:55:33 +0800] "GET/BL HTTP /1.1 "404 279"-"" mozilla/5.0 (Windows NT 6.1; WOW64; rv:37.0) gecko/20100101 firefox/37.0 "192.168.65.1--[28/mar/2015:23:56:01 +0800]" get/bl/in.html http/1.1 "200 21"-"" mozilla/5.0 (Windows NT 6.1; WOW64; rv:37.0) gecko/20100101 firefox/37.0 "[[email protected] bieming]#
Through this experiment found a more interesting problem, that is, when all the aliases and other settings, you need to access the alias directory of the specific files in order to access, if directly access to the directory, even in the alias <directory. The >--options define indexes and cannot be listed, only if you access a specific file after you access the directory indexes have the effect
This article is from the "impermanence" blog, please be sure to keep this source http://1inux.blog.51cto.com/10037358/1640557
httpd site alias settings