HAproxy 基础8

2022-01-19 11:10:52 浏览数 (2)

启动nginx,作为一个后端的web服务器

代码语言:javascript复制
[root@h102 nginx]# sbin/nginx  -t -c conf/nginx.conf
the configuration file /usr/local/nginx/conf/nginx.conf syntax is ok
configuration file /usr/local/nginx/conf/nginx.conf test is successful
[root@h102 nginx]# sbin/nginx   -c conf/nginx.conf
[root@h102 ~]# netstat  -ant | grep 80
tcp        0      0 0.0.0.0:80                  0.0.0.0:*                   LISTEN      
[root@h102 ~]# 

修改haproxy配置

代码语言:javascript复制
[root@h102 ~]# vim /etc/haproxy/transparent_proxy.cfg
[root@h102 ~]# grep -v "^#" /etc/haproxy/transparent_proxy.cfg 

global
defaults
	timeout client		30s
	timeout server		30s
	timeout connect		30s

frontend MyFrontend
	bind	0.0.0.0:1234
	default_backend		TransparentBack_http

backend TransparentBack_http
	mode			http
	server			MyWebServer 127.0.0.1:80

[root@h102 ~]#

0 人点赞