基本上,我有一台树莓派,它在不同端口上有多个 Web 服务器守护进程,具体来说是 lighttpd、apache 和 ADAFruit WebIDE。基本上,以下是我需要它工作的方式[您认为如何最好地编写配置文件?]:
http://RasberryPi:80/ > http://localhost:8080/
https://RasberryPi:443/ > http://localhost:8080/
(or if it cant be done as root folder to be /apache)
http://RaspberryPi:80/WebIDE > http://localhost:8081/
https://RasberryPi:443/WebIDE > http://localhost:8081/
http://RasberryPi:80/lighttp > http://localhost:8082/
https://RasberryPi:443/lighttp > http://localhost:8082/
我知道它应该类似于以下内容,但如果我不想要负载平衡怎么办?即使目标服务器不支持 https,我也想要 https?:
frontend http-in
bind 10.254.23.225:80
acl has_special_uri path_beg /special
use_backend special_server if has_special_uri
default_backend webfarm
backend webfarm
balance roundrobin
cookie SERVERID insert
option httpchk HEAD /check.txt HTTP/1.0
option httpclose
option forwardfor
server webA 10.254.23.4:80 cookie webA check
server webB 10.248.23.128:80 cookie webB check
backend special_server
balance roundrobin
cookie SERVERID insert
option httpchk HEAD /check.txt HTTP/1.0
option httpclose
option forwardfor
server webC 10.0.0.1:80 cookie webC check
答案1
您基本上已经完成了。配置三个后端:
apache
,只有服务器localhost:8080
lighttpd
,与服务器localhost:8082
webide
,与服务器localhost:8081
设定apache
您的默认后端。acl
如果 URI 以适当的路径开头,则添加 s 以使用其他后端。