【在CentOS下安装haproxy】

  1. sudo yum install haproxy

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

  1. #---------------------------------------------------------------------
  2. # Example configuration for a possible web application. See the
  3. # full configuration options online.
  4. #
  5. # http://haproxy.1wt.eu/download/1.4/doc/configuration.txt
  6. #
  7. #---------------------------------------------------------------------
  8.  
  9. #---------------------------------------------------------------------
  10. # Global settings
  11. #---------------------------------------------------------------------
  12. global
  13. # to have these messages end up in /var/log/haproxy.log you will
  14. # need to:
  15. #
  16. # 1) configure syslog to accept network log events. This is done
  17. # by adding the '-r' option to the SYSLOGD_OPTIONS in
  18. # /etc/sysconfig/syslog
  19. #
  20. # 2) configure local2 events to go to the /var/log/haproxy.log
  21. # file. A line like the following can be added to
  22. # /etc/sysconfig/syslog
  23. #
  24. # local2.* /var/log/haproxy.log
  25. #
  26. log 127.0.0.1 local2
  27.  
  28. chroot /var/lib/haproxy
  29. pidfile /var/run/haproxy.pid
  30. maxconn 4000
  31. user haproxy
  32. group haproxy
  33. daemon
  34.  
  35. # turn on stats unix socket
  36. stats socket /var/lib/haproxy/stats
  37.  
  38. #---------------------------------------------------------------------
  39. # common defaults that all the 'listen' and 'backend' sections will
  40. # use if not designated in their block
  41. #---------------------------------------------------------------------
  42. defaults
  43. mode http
  44. log global
  45. option httplog
  46. option dontlognull
  47. option http-server-close
  48. option forwardfor except 127.0.0.0/8
  49. option redispatch
  50. retries 3
  51. timeout http-request 10s
  52. timeout queue 1m
  53. timeout connect 10s
  54. timeout client 1m
  55. timeout server 1m
  56. timeout http-keep-alive 10s
  57. timeout check 10s
  58. maxconn 3000
  59.  
  60. #---------------------------------------------------------------------
  61. # main frontend which proxys to the backends 前端端口5000,规则url路径,静态文件名
  62. #---------------------------------------------------------------------
  63. frontend main *:5000
  64. acl url_static path_beg -i /static /images /javascript /stylesheets
  65. acl url_static path_end -i .jpg .gif .png .css .js
  66.  
  67. use_backend static if url_static
  68. default_backend app
  69.  
  70. #---------------------------------------------------------------------
  71. # static backend for serving up images, stylesheets and such 后端静态文件服务器
  72. #---------------------------------------------------------------------
  73. backend static
  74. balance roundrobin
  75. server static 192.168.0.27:80 check
  76.  
  77. #---------------------------------------------------------------------
  78. # round robin balancing between the various backends 后端动态文件服务器
  79. #---------------------------------------------------------------------
  80. backend app
  81. balance roundrobin
  82. server app1 192.168.0.27:80 check
  83. server app2 192.168.0.28:80 check
  1. sudo service haproxy restart

【在CentOS下安装apache】

CentOS的软件管理程序是yum

首先还是安装Apache。

  1. sudo yum install httpd

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

  1. sudo chkconfig --levels 235 httpd on

然后立即启动Apache服务。

  1. 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. ThinkPHP公共配置文件与各自项目中配置文件组合的方法

    ThinkPHP公共配置文件与各自项目中配置文件组合的方法 文章TAG:thinkphp 公共配置文件 时间:2014-11-25来源:www.aspku.com 作者:源码库 文章热度: 146 ℃ ...

  2. Unity 为NGUI增加体感输入方式

    背景 NGUI在处理UI和输入方面确实做的不错,但是现在的问题是公司引入体感之后,是通过手的位置来实现按钮的点击操作,前提我不想改变原先设计好的NGUI界面和机制,怎么破? NGUI的输入底层机制 N ...

  3. memcached学习笔记5--socke操作memcached 缓存系统

    使用条件:当我们没有权限或者不能使用服务器的时候,我们需要用socket操作memcached memcached-client操作 特点: 无需开启memcache扩展 使用fsocketopen( ...

  4. Natural Language Toolkit

    http://www.nltk.org/ >>> import nltk >>> nltk.download()

  5. The world beyond batch: Streaming 101

    https://www.oreilly.com/ideas/the-world-beyond-batch-streaming-101 https://www.oreilly.com/ideas/the ...

  6. DML以及DQL的使用方法

    DML:数据操作语言 1.插入insert into 单行插入:insert into 表名 (字段名, 字段名,...) values (值, 值, ...) 注:值列表要和字段列表相匹配. ins ...

  7. 用c++builder读取一个一行有多行变量的文件

    文件内容如下: C DXDY.INP FILE, IN FREE FORMAT ACROSS COLUMNS for  83658 Active CellsC 2013-5-25   上午 10:43 ...

  8. window对象;document对象;

    window对象: DOM:文档对象模型 --树模型文档:标签文档,对象:文档中每个元素对象,模型:抽象化的东西 一:window: 属性(值或者子对象):opener:打开当前窗口的源窗口,如果当前 ...

  9. Object的属性property详细解释(自动生成成员变量)

    类Class中的属性property: 在ios第一版中,我们为输出口同时声明了属性和底层实例变量,那时,属性是oc语言的一个新的机制,并且要求你必须声明与之对应的实例变量,例如: @interfac ...

  10. jade反编译

    安装html2jade npm install html2jade -g 反编译,默认输出同名jade html2jade test2.html 反编译为其他文件名 html2jade test2.h ...