Deprecated: Return type of Requests_Cookie_Jar::offsetExists($key) should either be compatible with ArrayAccess::offsetExists(mixed $offset): bool, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /var/www/techmemo/wp-includes/Requests/Cookie/Jar.php on line 63

Deprecated: Return type of Requests_Cookie_Jar::offsetGet($key) should either be compatible with ArrayAccess::offsetGet(mixed $offset): mixed, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /var/www/techmemo/wp-includes/Requests/Cookie/Jar.php on line 73

Deprecated: Return type of Requests_Cookie_Jar::offsetSet($key, $value) should either be compatible with ArrayAccess::offsetSet(mixed $offset, mixed $value): void, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /var/www/techmemo/wp-includes/Requests/Cookie/Jar.php on line 89

Deprecated: Return type of Requests_Cookie_Jar::offsetUnset($key) should either be compatible with ArrayAccess::offsetUnset(mixed $offset): void, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /var/www/techmemo/wp-includes/Requests/Cookie/Jar.php on line 102

Deprecated: Return type of Requests_Cookie_Jar::getIterator() should either be compatible with IteratorAggregate::getIterator(): Traversable, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /var/www/techmemo/wp-includes/Requests/Cookie/Jar.php on line 111

Deprecated: Return type of Requests_Utility_CaseInsensitiveDictionary::offsetExists($key) should either be compatible with ArrayAccess::offsetExists(mixed $offset): bool, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /var/www/techmemo/wp-includes/Requests/Utility/CaseInsensitiveDictionary.php on line 40

Deprecated: Return type of Requests_Utility_CaseInsensitiveDictionary::offsetGet($key) should either be compatible with ArrayAccess::offsetGet(mixed $offset): mixed, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /var/www/techmemo/wp-includes/Requests/Utility/CaseInsensitiveDictionary.php on line 51

Deprecated: Return type of Requests_Utility_CaseInsensitiveDictionary::offsetSet($key, $value) should either be compatible with ArrayAccess::offsetSet(mixed $offset, mixed $value): void, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /var/www/techmemo/wp-includes/Requests/Utility/CaseInsensitiveDictionary.php on line 68

Deprecated: Return type of Requests_Utility_CaseInsensitiveDictionary::offsetUnset($key) should either be compatible with ArrayAccess::offsetUnset(mixed $offset): void, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /var/www/techmemo/wp-includes/Requests/Utility/CaseInsensitiveDictionary.php on line 82

Deprecated: Return type of Requests_Utility_CaseInsensitiveDictionary::getIterator() should either be compatible with IteratorAggregate::getIterator(): Traversable, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /var/www/techmemo/wp-includes/Requests/Utility/CaseInsensitiveDictionary.php on line 91
实战Squid的反向代理在共享IP的VPS上的应用 – Tech Memo

实战Squid的反向代理在共享IP的VPS上的应用

实战Squid的反向代理在共享IP的VPS上的应用
Web, 服务器 Add comments 八 252009Squid作为一款相当优秀的代理、负载均衡软件,其反向代理功能在提高网站性能上有极大的推动作用,并兼有保护Web服务器、自动负载均衡等功能。今有一服务器,装有VMWare server,其上带着几个VPS,只有一个IP可用。VPS通过NAT访问外网,外网通过IP Forwading访问VPS,IP Forwading中绑定主机端口都不可能是80,所以需要将带有Host头的80端口的包,按照一定的规则,分发给不同的VPS使用。使用Apache的mod_proxy可以实现此功能,但是其效能低下,如今改用Squid来实现此功能。
配置文件如下:
acl all port 80
http_port 80 accel defaultsite=mysite.com vhost
cache_peer 127.0.0.1 parent 10801 0 no-query originserver name=server_1
cache_peer_domain server_1 www.mysite1.com .mysite1.com

cache_peer 127.0.0.1 parent 10802 0 no-query originserver name=server_2
cache_peer_domain server_2 www.mysite2.com .mysite2.com

http_access allow all

第二行中的mysite.com指定当传递的HTTP头中HOST为空时,默认的值。
第三行、第四行是定义服务器1的IP地址、端口和默认域名,泛域名
第六行、第七行是定义服务器2的IP地址、端口和默认域名,泛域名

这样一样,squid就可以根据HOST来分发包了。若再加上Cache特性,其性能一定会发挥得更好。在此就不多叙述了

Leave a Reply

Your email address will not be published.