LINUX Under Apache Server Configuration Raiders (8)

zhaozj2021-02-11  231

LINUX Under Apache Server Configuration Raiders (8)

Author: Bo OSO Oso

The settings for setting access control are primarily set for directory and files, however, access control settings for different URLs, so you don't have to worry about Scriptalias, whether Alias ​​sets the path to the controlled directory. The statement controlled for the URL is a Location statement, which not only provides protection on the file on the server, but also protects the corresponding file, but is the 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 statistics for the Apache server. Instructed with this, there is also an ExtendedStatus parameter that allows the server to output a more detailed report.

#

#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 a proxy function, however this requires the load into the Mod_Proxy module. This can use the IFModule statement to determine if there is a Mod_Proxy module, use ProxyRequests to open proxy support. Since then Directory is used to set access to the proxy function, and each parameter setting for setting the buffer is set.

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

# Rlog logs / host.some_domain.com-error_log

# Customlog logs / host.some_domain.com-access_log Common

#

#

These contents in the default setting file are used when setting up a named virtual host server.

Where NameVirtualHost to specify the IP address used by the virtual host, this IP address will correspond to multiple DNS names. If Apache uses the Listen parameter to control multiple ports, then the port number can be added to further distinguish between different ports. Different connection requests. Since then, use the VirtualHost statement, use the IP address specified by NameVirtualHost to make a parameter, and the corresponding virtual host settings are defined for each name.

The virtual host is on a web server that provides a web service for multiple separate domain names, and each domain name is completely independent, including complete independent document directory structure and settings, which are completely independent, not only each The content of the domain name is completely independent, and it is unable to access another domain name.

Ask other domain names to provide web page content.

The concept of virtual host is very useful for ISP, because although an organization can hook your own web pages on a lower-level recipient on a server with other domain names, but use independent domain names and root URLs more formal, easy to accept people . Traditionally, it is necessary to set up a server to achieve a separate domain name, but this requires a separate server, many small units lack sufficient maintenance capabilities, and more appropriate ways to rent someone else maintained servers. ISP does not necessarily provide a single server to provide a virtual host capability, allowing the server to provide Web services for multiple domain names, and different services do not interfere with each other, and except for multiple different servers. There are two ways to set the virtual host, one is based on the HTTP 1.0 standard, requires a multi IP

The address of the address, then configure the DNS server, give each IP address at different domain names, and finally configure the Apache configuration file, so that the server returns different web documents for different domain names. Since this requires an additional IP address, you need to use a separate IP address for each domain name to which you want to provide services, so this manner has achieved more problems.

You can bind multiple IP addresses on a network interface. Under Linux, you need to use the Alias ​​parameters of IFConfig to make this configuration, but it will affect network performance.

The HTTP 1.1 standard specifies the server to track the browser and server communication in the agreement.

Which host name is requested by the envelope. So this new feature can be used to use a more easy way

Virtual host. This method does not require additional IP addresses, but requires a new version of browser support. This approach has become a standard way to establish a virtual host.

To establish a non-IP-based virtual host, multiple domain names are indispensable because each domain name is

A virtual host to be served. Therefore, you need to change the configuration of the DNS server to add multiple C name options for the server, such as:

Linux in A 192.168.1.64

Vhost1 in CName Linux

vhost2 in cname Linux

Basic setting options are set for Linux hosts, if you want to set up vhost1 and vhost2

Virtual hosts, use the VirtualHost statement to define different options, you can use most of the statements in front of the configuration file to redefine almost all of the settings for the server.

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

It should be noted here that VirtualHost's parameter addresses must be consistent with the address defined by NameVirtualHost, and must ensure that all values ​​are strict, and the Apache server recognizes that these definitions are virtual hosts defined for this IP address.

In addition, after NameVirtualHost is defined, the access to this IP address is detailed, and access to other IP addresses, such as 127.0.0.1, is applied to the default option for the previously defined default.

>> Previous article: Linux Apache Server Configuration Raiders (7) >> Next article: Colorful new products: ThinkPad options new contact

转载请注明原文地址:https://www.9cbs.com/read-3654.html

New Post(0)