官术网_书友最值得收藏!

  • Lighttpd
  • Andre Bogus
  • 301字
  • 2021-08-25 18:06:23

mod_proxy_core and backends

Since version 1.5.0, the dynamic page processing interface core functionality was consolidated into mod_proxy_core and only the differences between the interfaces moved into a backend for each. This reduces duplication, with some obvious benefits. Less duplicated code implies less stuff in memory, less chances for errors, more testing for the core, and optimizations apply to all interfaces.

The syntax has changed a little, for example, we no longer assign path prefixes to configurations, but use selectors to reduce the reach of the backends.

Suppose that we want to use mod_proxy_core, we add it to server_modules along with the backends we want. Then we carve out a niche for each backend and configure the backends. For example, to use SCGI for a python application and FastCGI for PHP, we write:

server.modules = ( ...,
"mod_proxy_core",
"mod_proxy_backend_fastcgi",
"mod_proxy_backend_scgi", # see appendix B for all backends.
... )
$HTTP["url"] =~ ".py" { # use SCGI for python files
proxy_core.protocol = "scgi"
proxy-core.balancer = "carp" # tries to keep processes together
proxy-core.backends = { # we have 3 SCGI servers to balance:
"127.0.0.1:3456", # a local port (by IP address)
"otherhost.mydomain.net:3456", # a port on another host
"unix:/tmp/python.socket" # a unix socket
}
proxy-core.max-pool-size = 3 # for SCGI the number of backends
# for other options, see Appendix B
}
$HTTP["url"] =~ ".php" { # use FastCGI for PHP files
proxy_core.protocol = "fastcgi"
proxy-core.balancer = "sqf" # tries to balance workload fairly
proxy-core.backends = {
"unix:/tmp/php-fastcgi.socket",
"[::1]:4001" # on IPv6 host 1 in this network, port 4001
}
proxy-core.max-keep-alive-requests = 8
# analog to server.max-keep-alive-requests, see chapter 9
proxy-core.allow-x-sendfile = "enable" # see chapter 9
}

The use of selectors gives us greater freedom on when to use which backend, and the uniform syntax makes it easy to learn and use.

主站蜘蛛池模板: 香港 | 长宁县| 扶风县| 华池县| 兴义市| 余江县| 依安县| 疏附县| 贵州省| 昆山市| 玛纳斯县| 大新县| 顺昌县| 灵台县| 金乡县| 银川市| 泸州市| 馆陶县| 百色市| 霍林郭勒市| 加查县| 平顺县| 伊川县| 桑植县| 民勤县| 太和县| 淮阳县| 华阴市| 扎囊县| 岗巴县| 红河县| 丘北县| 西丰县| 盘山县| 阿克| 深水埗区| 彩票| 乌恰县| 新郑市| 怀远县| 桦甸市|