【在CentOS下安装haproxy】

sudo yum install haproxy

编辑配置文件 vim /etc/haproxy/haproxy.cfg

#---------------------------------------------------------------------
# Example configuration for a possible web application. See the
# full configuration options online.
#
# http://haproxy.1wt.eu/download/1.4/doc/configuration.txt
#
#--------------------------------------------------------------------- #---------------------------------------------------------------------
# Global settings
#---------------------------------------------------------------------
global
# to have these messages end up in /var/log/haproxy.log you will
# need to:
#
# 1) configure syslog to accept network log events. This is done
# by adding the '-r' option to the SYSLOGD_OPTIONS in
# /etc/sysconfig/syslog
#
# 2) configure local2 events to go to the /var/log/haproxy.log
# file. A line like the following can be added to
# /etc/sysconfig/syslog
#
# local2.* /var/log/haproxy.log
#
log 127.0.0.1 local2 chroot /var/lib/haproxy
pidfile /var/run/haproxy.pid
maxconn 4000
user haproxy
group haproxy
daemon # turn on stats unix socket
stats socket /var/lib/haproxy/stats #---------------------------------------------------------------------
# common defaults that all the 'listen' and 'backend' sections will
# use if not designated in their block
#---------------------------------------------------------------------
defaults
mode http
log global
option httplog
option dontlognull
option http-server-close
option forwardfor except 127.0.0.0/8
option redispatch
retries 3
timeout http-request 10s
timeout queue 1m
timeout connect 10s
timeout client 1m
timeout server 1m
timeout http-keep-alive 10s
timeout check 10s
maxconn 3000 #---------------------------------------------------------------------
# main frontend which proxys to the backends 前端端口5000,规则url路径,静态文件名
#---------------------------------------------------------------------
frontend main *:5000
acl url_static path_beg -i /static /images /javascript /stylesheets
acl url_static path_end -i .jpg .gif .png .css .js use_backend static if url_static
default_backend app #---------------------------------------------------------------------
# static backend for serving up images, stylesheets and such 后端静态文件服务器
#---------------------------------------------------------------------
backend static
balance roundrobin
server static 192.168.0.27:80 check #---------------------------------------------------------------------
# round robin balancing between the various backends 后端动态文件服务器
#---------------------------------------------------------------------
backend app
balance roundrobin
server app1 192.168.0.27:80 check
server app2 192.168.0.28:80 check
sudo service haproxy restart

【在CentOS下安装apache】

CentOS的软件管理程序是yum

首先还是安装Apache。

sudo yum install httpd

与openSUSE类似,安装完需要自己手动配置服务自启动。

sudo chkconfig --levels 235 httpd on

然后立即启动Apache服务。

sudo /etc/init.d/httpd start

现在再用浏览器访问服务器地址就可以正常访问Http服务器了。

CentOS6.5 安装HAProxy 1.5.20的更多相关文章

  1. Centos6 yum安装openldap+phpldapadmin+TLS+双主配置

    原文地址:http://54im.com/openldap/centos-6-yum-install-openldap-phpldapadmin-tls-%E5%8F%8C%E4%B8%BB%E9%8 ...

  2. CentOS6.X安装vsftpd服务

    #-----------------CentOS6.X安装VSFTPD服务 #! /bin/sh #1.关闭selinux setenforce 0 sed -i 's/enforcing/disab ...

  3. CentOS-6.5安装配置JDK-7|Tomcat-8

    安装说明 系统环境:centos-6.5 安装方式:rpm安装 软件:jdk-7-linux-x64.rpm 下载地址:http://www.oracle.com/technetwork/java/j ...

  4. centos6.5 安装jdk7和tomcat7

    JDK安装: 安装说明 系统环境:centos-6.5安装方式:rpm安装软件:jdk-7-linux-x64.rpm下载地址:http://www.oracle.com/technetwork/ja ...

  5. CentOS-6.3安装配置JDK-7或 JDK-6

    链接地址:http://blog.csdn.net/shuixin536/article/details/8954000 http://www.cnblogs.com/zhoulf/archive/2 ...

  6. Centos6.9安装vsftpd并配置多用户的方法

    本文介绍了Centos6.9安装vsftpd并配置多用户的方法,分享给大家,具体如下: 一.安装vsftpd ? 1 2 3 4 5 6 7 8 #安装vsftpd yum -y install vs ...

  7. saltstack SLS 安装haproxy+nginx实例分析学习

    本文主要以实例的形式去熟悉sls的部署流程及相关模块的使用 文件下载:https://github.com/unixhot/saltbook-code 目录结构 [root@k8s_master sa ...

  8. Mysql系列三:Centos6下安装Mysql和Mysql主从复制的搭建

    一.Centos6下安装Mysql 检测下系统有没有自带的mysql:yum list installed | grep mysql, 如果已经有的话执行命令yum -y remove mysql-l ...

  9. CentOS-6.5安装配置JDK-7

    安装说明 系统环境:centos-6.5安装方式:rpm安装 软件:jdk-7-linux-x64.rpm下载地址:http://www.oracle.com/technetwork/java/jav ...

随机推荐

  1. memory_limit session.cache_expire ecshop初始化注释说明

    memory_limit session.cache_expire ecshop初始化注释说明 memory_limit = 128M; 一个脚本所能够申请到的最大内存字节数(可以使用K和M作为单位) ...

  2. Web--RSS

    --用处:SEO,让别人订阅你的文章

  3. mysqli_multi_query($link, $wsql)

    if (mysqli_multi_query($link, $wsql)) { do { if ($result = mysqli_store_result($link)) { mysqli_free ...

  4. Byte History

    https://en.wikipedia.org/wiki/Byte The term byte was coined by Werner Buchholz in July 1956, during ...

  5. OneDrive无法正常登录

    可能是DNS被污染 手动设置DNS 134.170.108.26 onedrive.live.com134.170.108.152 skyapi.onedrive.live.com

  6. java时间格式串

    yyyy-mm-dd 和yyyy-MM-dd转换出来的日期不用. 用"yyyy-MM-dd"

  7. CSS :before和:after (转)

    前几天的晚上较全面的去看了下css的一些文档和资料,大部分的样式运用都没什么大问题了,只是有些许较陌生,但是也知道他们的存在和实现的是什么样式.今天主要想在这篇学习笔记中写的也不多,主要是针对:bef ...

  8. 自己diy一个jquery分页插件

    js基础学习过程中,期间经历换工作的各种面试,很多面试官问过:有没有写过jquery插件?等类似问题. 就个人而言,关于jquery插件的文章确实看过不少,但是一直没有动手写一个,一是不想在目前学习j ...

  9. 导出证书Cer文件为Pem格式的步骤

    (1)先导出Push Services的证书,比如我们命名为“magic_cert.p12”,注意导出时会让你输入密码. (2)再导出Push Services证书的密钥(Private Key),比 ...

  10. Wordpress更改后台地址

    wordpress默认的后台地址是 xx/wp-admin  或xx/wp-login.php ,谁都知道感觉很不安全, 方法一:使用插件 通过插件在地址上加上只有你知道的参数才能访问 1.后台搜索插 ...