httpd site alias settings

Source: Internet
Author: User
Tags aliases

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.