Sitting site planning 1 - MOD

zhaozj2021-02-16  73

A MOD_PROXY that uses Apache to do a Web acceleration in multiple sites HTTP Acceleration scenario:

The original site planning may be like this:

*. *. *. 1 culture.a.com *. *. *. 2 /* .*. 4 /*.*. 5 news.a.com *. *. *. 6 auto.a.com ...

In the design of the cached server: all sites point to the same IP (or 2 to 3) by external DNS: *. *. *. 100/101 (for example)

Working principle: When the external request comes, set the cache according to the configuration file settings. In this way, the server request can be forwarded to the internal address we specified. In terms of processing multi-virtual host steering: MOD_PROXY is simpler than Squid: You can turn different services to different ports of multiple IPs in the background.

Squid can only be disabled by disabling DNS parsing, and then forwards the address based on the local / etc / hosts file, and multiple servers must use the same port. But in terms of performance, professional-level Squid is more excellent than Mod Proxy.

Today, make APACHE MOD_PROXY documents. Tomorrow should make Squid's Web Acceleration document on multiple sites

Based on Apache MOD_PROXY, the Apache contains the Mod_Proxy module, which can be used to implement the proxy server, against the reverse speed of the background server Note: Apache 2.x MOD_PROXY has been separated into mod_proxy and mod_cache: MOD_CACHE Different implementations based on files and memory-based

Practical test 1: Environment: One Sun Ultra 60 for Solaris 8 runs Bind 9, adding several virtual IPs to the corresponding address: www.my.net 10.1.1.201China .my.net 10.1.1.202 Test Plan: Install Apache 1.3.31 first to configure the previous Cache Server, then install an Apache1.3.31 to configure the real web server. Put some static pages, then do the test, draw conclusions. 1. Compile Apache (used to do cache)

./configure --prefix = / usr / local / apache-front --enable-shared = max --enable-module = MOST && Make && Make Install (please pay attention to the following)

Compile time error:

. There is a file with libexpat.so.0, therefore as long as: export ld_library_path = / lib: / usr / lib: / usr / local / lib compiles can be reported when the Apache is started: SYNTAX ERROR ON LINE 206 of / usr / local /APache-front/conf/httpd.conf:cannot loading /usr/local/apache-front/libexec/mod_env.so INTO Server: ld.so.1: / usr / local / apache-front / bin / httpd: Fatal : RELOCATION Error: file /usr/local/apache-front/libexec/mod_env.so: Symbol AP_Palloc: Reference Symbol Not found ../ bin / apachectl start: httpd could not be started If you commented by MOD_ENV.so from the configuration file It will also report the same error on the module ENV_MODULE, it seems that it cannot be compiled with DSO mode: ./ Configure --prefix = / usr / local / apache-front-enable-module = MOST && Make && make Install

2. Compile the Apache to install Web Server:

./configure --prefix = / usr / local / apache-back && make && make install

3. Perform a corresponding configuration:

Create / VAR / WWW / Proxy directory and set the permissions to Nobody: Nobody

Modify apache-front's httpd.conf: serveradmin admin@my.netServername www.my.net

Proxypass / http:8080/3/2://china.my.net:8080/

ProxyPassReverse / http://china.my.net:8080/

# cache dir root

Cacheroot "/ var / www / proxy"

# Max Cache Storage

Cachesize 500M

# Hour: Every 4 Hour

Cachegcinterval 4

# Max Page Expire Time: HOUR

Cachemaxexpire 240

# Expire Time = (now - last_modified) * CacheLastModifiedFactor

CacheLastModifiedFactor 0.1

# Defalt Expire Tag: Hour

CachedefaultExpire 1

# Force Complete After Precent of Content Retrived: 60-90%

CacheforceCompletion 80

Customlog / usr / local / apache-front / logs / access_log combined

Modify apache-back httpd.conflisten 10.1.1.202:8080 ServerAdmin root@my.netServerName China.my.net Basic configuration This, if any other requirement can be adjusted according to the actual situation.

Test: Since the pressure test is not performed, the main check of the log of logs is consistent with the same proxy. Simply put a small site HTDOCS file, then access 80 in a Telnet, and access it in a Windows client with browser. Since it makes a simple DNS server on the lab, you can specify that the DNS server is 10.1.1.198, so that a disadvantage is that the website is not accessible, and another convenient method is to modify the HOSTS file of Windows. Add 10.1.1.202 China.my.net

Conclusion: In addition to the speed of speed, there are several obvious advantages to: Configuration is convenient. Log records, like the original, just recorded on Apache running MOD_PROXY, so there is no problem for the company's use of statistics PV values!

Reference documentation:

1. http://www.chedong.com/tech/cache.html Car Dong's article: WEB cache acceleration based on reverse agent - Cachel CMS system design (main reference documentation in this article, I mainly add Operation of an instance)

2. Http://www.apache.org apache homepage

3. Http://www.squid-cache.org Squid homepage

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

New Post(0)