Article Title: Apache server configuration overview (8 ). Linux is a technology channel of the IT lab in China. Includes basic categories such as desktop applications, Linux system management, kernel research, embedded systems, and open source.
The settings used to set access control are mainly for directories and files. However, you can also set access control for different URLs, in this way, you don't have to worry about whether ScriptAlias and Alias have set the path out of the controlled directory. The URL-specific control statement is the Location statement, which not only protects files and CGI on the server, but also protects files that cannot be found, it is a special function URL provided by the server itself. Http: // servername/server-status is used to report the status of the current Apache server. http: // servername/server-info is used to report the statistics of the Apache server. The ExtendedStatus parameter is also related to this setting, which allows the server to output more detailed reports.
The Apache server itself has the proxy function, but this requires loading the mod_proxy module. This can be determined using the IfModule statement. If the mod_proxy module exists, use ProxyRequests to enable Proxy Support. The following Directory is used to set access permissions for the Proxy function and to set parameters for caching.
Virtual Host
# NameVirtualHost 12.34.56.78: 80
# NameVirtualHost 12.34.56.78
#
# ServerAdmin webmaster@host.some_domain.com
# DocumentRoot/www/docs/host. some_domain.com
# ServerName host. some_domain.com
# ErrorLog logs/host. some_domain.com-error_log
# CustomLog log logs/host. some_domain.com-access_log common
#
#
The content in the default setting file is used to set the name of The Basic VM server.
NameVirtualHost specifies the IP address used by the VM. This IP address corresponds to multiple DNS names. If Apache uses the Listen parameter to control multiple ports, then you can add the port number here to further differentiate different connection requests for different ports. Afterwards, the VirtualHost statement is used to specify the IP address specified by NameVirtualHost as the parameter, and the corresponding virtual host settings are defined for each name.
A vm is deployed on a Web server. It can provide Web Services for multiple independent domain names, and each domain name is completely independent, including a completely independent document directory structure and settings, in this way, domain names are completely independent, not only the content accessed by each domain name is completely independent, but also the webpage content provided by other domain names cannot be accessed using another domain name.
The concept of a VM is very useful for ISPs, because although an organization can link its webpage to a lower-level server with other domain names, however, the use of independent domain names and root URLs is more formal and easy for everyone to accept. Traditionally, you must set up a server on your own to achieve the purpose of a separate domain name. However, this requires maintaining a separate server. Many small organizations lack sufficient maintenance capabilities, A more suitable way is to lease servers maintained by others. ISP does not need to provide a separate server for an organization. It can use the virtual host capability to provide Web services for multiple domain names, and different services do not interfere with each other, multiple servers are displayed externally.
There are two ways to set up virtual hosts. One is based on the HTTP 1.0 standard. A server with multiple IP addresses is required, and then the DNS server is configured to give each IP address a different domain name, finally, you can configure the Apache configuration file so that the server returns different Web documents for different domain names. Because this requires additional IP addresses, each domain name to provide services must use a separate IP address. Therefore, this method has many problems.
You can bind multiple IP addresses to a network interface. in Linux, you need to use the alias parameter of ifconfig for this configuration, but this will affect network performance.
The HTTP 1.1 Standard specifies the host name that the server can track when a browser communicates with the server. Therefore, you can use this new feature to easily set virtual hosts. This method does not require additional IP addresses, but requires support from new browsers. This method has become a standard method for creating virtual hosts.
To create a non-IP-based Vm, multiple domain names are indispensable because each domain name corresponds to a VM to be served. Therefore, you need to change the DNS server configuration to add multiple c name options for the server, such:
Linux in a 192.168.1.64
Vhost1 in cname linux
Vhost2 in cname linux
The basic setting options are all set for linux Hosts. To set virtual hosts for vhost1 and vhost2, you must use the VirtualHost statement to define different options, in the statement, you can use most of the options in front of the configuration file, and you can redefine almost all server-specific settings.
NameVirtualHost 192.168.1.64
DocumentRoot/www/data
ServerName linux.example.org.cn
DocumentRoot/vhost1
ServerName vhost1.example.org.cn
DocumentRoot/vhost2
ServerName vhost2.example.org.cn
Note that the VirtualHost parameter address must be consistent with the address defined by NameVirtualHost, and all values must be strictly consistent, the Apache server acknowledges that these definitions are virtual hosts defined for this IP address.
After NameVirtualHost is defined, access to this IP address is processed by different virtual hosts, and access to other IP addresses, such as 127.0.0.1, to apply the default options defined earlier.
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