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 Apache
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.
#
# ProxyRequests On
#
#
# Order deny, allow
# Deny from all
# Allow from. your_domain.com
#
# ProxyVia On
# CacheRoot "/www/proxy"
# CacheSize 5
# CacheGcInterval 4
# CacheMaxExpire 24
# CacheLastModifiedFactor 0.1
# CacheDefaultExpire 1
# NoCache a_domain.com another_domain.edu joes. garage_sale.com
#
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 cannot be accessed by another domain name.
Ask the webpage content provided by other domain names.
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 the virtual host. one is based on the HTTP 1.0 standard and one needs to have multiple IP addresses
The address server, then configure the DNS server, give each IP address a different domain name, and finally 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 that when a browser communicates with a server, the server can track
Host Name requested by the browser. Therefore, you can use this new feature to set it more easily.
Virtual host. 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 virtual host, multiple domain names are indispensable because each domain name
A virtual host 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 set for the linux host.
For a VM, 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.
<全文完>