Apache Virtual Directory Configuration Instance

Source: Internet
Author: User
Tags root directory
First, open the virtual host configurationFound in file httpd.conf:
Include conf/extra/httpd-vhosts.conf #开启

Second, configure the httpd-vhost.conf file

Java code//listening ports, namevirtualhost <VirtualHost> tags rely on this oh namevirtualhost *:80 <virtualhost *:80> Servern  Ame testa.com documentroot "/var/www/test.com" <directory "/var/www/test.com" > Options Indexes multiviews FollowSymLinks allowoverride all Order allow,deny allow from all </Directory> errorlog "/var/l Og/httpd/error_test.log "Customlog"/var/log/httpd/comm_test.log "Common </VirtualHost>
Third, the local host to add the domain name IP correspondence relationship (single IP multi-domain can be done by different ports)

Httpd.conf is the primary configuration file for Apache, but for each directory, Apache also allows a file called. Htacess to be placed under their respective directories to control the properties of this directory.

Apache URL rewriting can be configured using Apache's rewrite module, and rewrite rules will be written in the. htaccess file.
But to enable Apache to read the contents of the. htaccess, you must configure the directory where the. htaccess is located.
Based on security considerations, the allowoverride attribute of the root directory is generally configured to "None" and does not allow any override, i.e.:
Java code <directory/> allowoverride None </Directory>
When AllowOverride is set to None, the. htaccess file is completely ignored. When this directive is set to all, any directives with the ". htaccess" Scope are allowed to appear in the. htaccess file.
For URL rewrite, at a minimum, you need to set the directory to:
Java code <Directory/blogRoot/> allowoverride FileInfo </Directory>
The allowoverride parameter indicates whether the Apache server is looking for a. htacess file as a configuration file, and if it is set to none, the server ignores it. Htacess file, if set to all, then all instructions in the. htaccess file will be rewritten. For allowoverride, it is also possible to specify the following types of instructions that can be overridden.
1), Authconfig allows the use of all permission directives, they include Authdbmgroupfile authdbmuserfile authgroupfile authname authtypeauthuserfile and Requi Re
2), FileInfo allows the use of the file control type of instructions. They include addencoding addlanguage addtype defaulttype errordocument languagepriority
3), Indexes allows the use of directory control type directives. They include adddescription AddIcon addiconbyencoding addiconbytype defaulticon directoryindex FancyIndexing HeaderName IndexIg Nore Indexoptions Readmename
4), Limit allows the use of permission control directives. They include allow deny and order
5), Options allows the use of commands that control the characteristics of the catalog. They include Options and Xbithack.

Options:
1), all allow the following except MultiViews all functions
2), multiviews allow multiple content to be browsed, if your directory has a file called Foo.txt, then you can visit it through/foo, which is useful for a multi-lingual content site
3), Indexes If there is no index file in this directory, then allow to display the file under this directory for selection, prohibit directory browsing can delete this or "-indexes".

Example:
Java code <directory/> options-indexes followsymlinks//or write as "Options followsymlinks" allowoverride N One Order Deny,allow deny from all </Directory>
4), includesnoexec allow SSI, but do not use #exec and # include features
5), includes allow SSI
6), followsymlinks in this directory, the server will track the symbolic link.
Note that even if the server traces a symbolic link, it does not change the pathname used to match the different regions, which is ignored if set within the <Local> tag.
7), SymLinksIfOwnerMatch in this directory only to track links within the site.
8), execcgi permission to use CGI in this directory

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.