Some basic configurations of apache

Source: Internet
Author: User

Apache configuration is configured in the httpd. conf file. Therefore, the following configuration commands are all modified in the httpd. conf file.
Configuration of the primary site (basic configuration)

Basic Configuration:


ServerRoot "/mnt/software/apache2" # location of your apache software installation. If no absolute path is specified for other specified directories, the directory is relative to this directory.

Listen 80 # Port Number of the server listener.

# You can set multiple port numbers.

ServerName www.test.com: 80 # main site name (website host name ).

ServerAdmin admin@test.com # administrator email address.

DocumentRoot "/mnt/web/test" # webpage storage location of the primary site.


Access Control for the Directory of the main site is as follows:

<Directory "/mnt/web/test">
Options FollowSymLinks
AllowOverride None
Order allow, deny
Allow from all
</Directory>

The preceding Directory attribute configuration mainly includes the following options:

Options: What features are used for configuration in a specific directory? common values and basic meanings are as follows:

FollowSymLinks: in this directory, the file system is allowed to use symbols to connect.

Indexes: if the user cannot find the main page file specified by directoryindex(for example, index.html), the list of files in the directory is returned to the user.

AllowOverride: indicates the type of the command that is allowed to exist in the. htaccess file. The file name of the. htaccess file can be changed. The file name is determined by the AccessFileName command ):
None: When AllowOverride is set to None. Do not search for. htaccess files in this directory (you can reduce the server overhead ).

All: All commands can be used in the. htaccess file.

Order: control which of the Allow and Deny access rules takes precedence during access:

Allow: List of hosts that can be accessed (available domain names or subnets, for example, Allow from 192.168.0.0/16 ).

Deny: List of Access Denied hosts.

DirectoryIndex index.html index.htm index. php # settings of the home page file (in this example, the home page file is set to index.html, index.htm and index. php)

 

Virtual Host Configuration


Listen 80
<VirtualHost 172.20.30.40>
DocumentRoot/www/example1
ServerName www.example1.com
</VirtualHost>
<VirtualHost 172.20.30.50>
DocumentRoot/www/example2
ServerName www.example2.org
</VirtualHost>

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.