Set virtual web using Apache Server

zhaozj2021-02-08  246

Set virtual web using Apache Server

Theunix platform is the same as the NT platform using the Apache Server settings. The following focuses on the UNIX platform as an example to illustrate the setting of the Apache Server. It is also worth noting that the successful setting of virtual Web has a workload of approximately 50% is registration and parsing in the domain name. So generally register a good domain name and then do virtual web settings. First, the IP type virtual host IP-type virtual host refers to each virtual host corresponding to the unique IP. This approach can be implemented by multiple IPs, Solaris 2.5, and Windows NT through multiple physical NICs or virtual network ports. Two ways to configure multiple virtual hosts: 1. Start an HTTPD process for each virtual host. Use this method under the following cases: • Consider security isolation issues, such as two httpds running in different User, Group, Listen,

ServerRoot, both users browse data through web, unable to access other data. • Provide sufficient memory and file descriptor. Setting method: Create a separate HTTPD installation for each virtual host, in each installation path httpd.conf, use the Listen instruction to specify the IP of the process service, such as Listen 10.68.37.10:80 2, for all virtual The host launches an HTTPD process. Use this method in the following cases: • Allow a shared HTTPD configuration between the virtual host. • Computer Services serve a large number of requests, run multiple processes to reduce server performance into important considerations

. Setting method: In the configuration file httpd.conf, set ServerAdmin for each virtual host with the VirtualHost instruction

, ServerName, DocumentRoot, ErrorLog, TransferLog or CustomLog, such as: # proposed here / etc / httpd / htdocs / smallco ServerName www.smallco.com # suggestion here with IP ServerAdmin webmaster@mail.smallco.com DocumentRoot / usr / local Domain name errorlog / usr / local / etc / httpd / logs / smallco / error_log transferlog / usr / local / etc / httpd / logs / smallco / access_log

# Proposed here with IP ServerAdmin webmaster@mail.baygroup.org DocumentRoot / groups / baygroup / www ServerName www.baygroup.org # suggestion here the domain name ErrorLog / groups / baygroup / logs / error_log TransferLog / groups / baygroup / logs / ACCESS_LOG

At the same time, you have to do a virtual network port or network card configuration, and you must do the corresponding settings in DNS. Second, named virtual hosts (Apache1.3 or above) IP virtual hosts are good, but not the best solution. It requires every virtual host to have a dedicated IP, in a certain

Some machines are difficult to implement. Name type virtual host refers to the name of each virtual host, but IP is the same. It is not limited

Quantity, configuration, use, easy to use, no additional hardware and software. Disadvantages are that the client must support this

Some protocols, recent version of browser support, some old version of the browser does not support. But Apache is this

Provide a solution. Setting method: In the configuration file httpd.conf, use the NameVirtualHost command to set the virtual host, such as NameVirtualHost 111.22.33.44 #. Suggests here to use IP ServerName www.domain.tld # recommended to use domain name Documentroot / Web / Domain, DNS defines www.domain.tld points to 111.22.33.44. Note: When using IP after the NameVirtualHost instruction, any URL request to use IP is for virtual

The primary server will never respond to a URL request using IP. In addition, some servers want to be accessed with multiple names. For example, suppose there is a server, hope

Both Domain.TLD, www2.domain.tld can be accessed, the practice is part of the VirtualHost instruction

Use the Serveralias directive. Such as: Serveralias Domain.tld * .domain.tld Also supplies some virtual host setting instances. Attachment: Virtual host set instance IP type virtual host configuration setup 1: The server has two IP, 111.22.33.44 server.domain.tld 111.22.33.55 www.therdomain.tld www.domain.tld is the alias of server.domain.tld (CNAME) represents the primary server. Server configuration: ... Port 80 DocumentRoot / WWW / Domain Servername www.domain.tld

DocumentRoot / WWW / OtherDomain Servername www.othersDomain.tld ...

Setup 2: Basically with Setup1, but does not set a special primary server. Server configuration: ... Port 80 ServerName Server.Domain.tld

Documentroot / WWW / Domain Servername www.domain.tld ...

DocumentRoot / WWW / OtherDomain Servername www.othersDomain.tld ...

This setting is only when the URL is http: //server.domain.tld, the main server setup 3: There are two IPs, 111.22.33.44 server.domain.tld 111.22.33.55 www-cache.domain.tld www .domain.tld is the alias (CNAME) of Server.Domain.TLD, represents the primary server. Www-cache.domain.tld is Proxy-Cache, the port is 8080, and the web server uses the default 80. Server configuration: ... Port 80 listen 111.22.33.44:80 listen 111.22.33.55:8080 servername server.domain.tld

Documentroot / WWW / Domain Servername www.domain.tld ...

Servername www-cache.domain.tld ...

ORDER DENY, ALOW DENY from ALLOW FROM 111.22.33

Name type virtual host configuration setup 1: The server has an IP, 111.22.33.44 server.domain.tld. Www.domain.tld and www.sub.domain.tld are alias (cnames). Server configuration: ... Port 80 ServerName Server.Domain.tld namevirtualhost 111.22.33.44documentroot / www / domain servername www.domain.tld ...

Documentroot / WWW / Subdomain Servername www.sub.domain.tld ...

If you use the IP access server, because www.domain.tld has the highest priority, it is considered to be the default service.

Or first server. Setup 2: The server has two IPs, 111.22.33.44 server1.domain.tld is used for primary server 111.22.33.55 server2.domain.tld is used for virtual host alias www.domain.tld is used for primary servers, alias www.othersDomain.tld For a virtual host, alias www.sub.domain.tld, *. Sub.Domain.tld is used for another virtual host, server configuration: ... Port 80 Servername www.domain.tld DocumentRoot / WWW / Domain NameVirtualHost 111.22 .3.55

DocumentRoot / WWW / OtherDomain Servername www.othersDomain.tld ...

Documentroot / WWW / Subdomain Servername www.sub.domain.tld serveralias * .sub.domain.tld ...

Hybrid (IP / Name) Virtual Host Configuration Setup: The server has three IPs, 111.22.33.44 server.Domain.tld For named virtual hosts 111.22.33.55 www.others 11.22.33.66 www.22.33.66 www. OtherDomain2.tld is used for IP type virtual host server configuration: ... Port 80 ServerName Server.Domain.tld namevirtualhost 111.22.33.44

Documentroot / WWW / Domain Servername www.domain.tld ...

Documentroot / WWW / Subdomain1 ServerName www.sub1.domain.tld ...

Documentroot / WWW / Subdomain2 Servername www.sub2.domain.tld ...

Documentroot / WWW / OtherDomain1 ServerName www.otherdomain1.tld ...

Documentroot / WWW / OtherDomain2 Servername www.otherdomain2.tld ...

Port type virtual host configuration setup: The server has an IP, 111.22.33.44 www.domain.tld does not require additional alias or IP, using a port type virtual host to set a configuration is different from the primary server

Virtual host. Server configuration: ... listen 80 listen 8080 ServerName www.domain.tld DocumentRoot / WWW / Domain

Documentroot / WWW / Domain2 ...

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

New Post(0)