zoukankan      html  css  js  c++  java
  • Nginx集群搭建笔记

    源码安装Nginx:
    $ tar -zxvf nginx-1.8.0.tar.gz -C /nginx/        #解压Nginx
    $ rpm -ivh keepalived-1.2.13-5.el6_6.i686.rpm        #安装keepalived
    $ service iptables status        #查看系统防火墙状态
    $ service iptables stop           #停止系统防火墙(重启后恢复)
    $ chkconfig iptables --list       #查看系统防火墙
    $ chkconfig iptables off          #禁用防火墙
    安装pre库:
    $ yum install -y pcre-devel     #在线或离线安装
    # 添加软连接:
    $ cd /lib/
    $ ls *pcre*
    $ find / -type f -name *libpcre.so.*
    $ ln -s /lib/libpcre.so.0.0.1 /lib/libpcre.so.1
    编译安装Nginx:
    $ cd /nginx/ 
    $ make && make install
    $ cd /usr/local/nginx/
    $ ./sbin/nginx     #启动Nginx服务器
    # http://192.168.38.128/浏览器访问,测试nginx是否可用
    # ps -aux | grep nginx查看nginx进程
    # ./sbin/nginx -s stop停止nginx(不使用)
    # ./sbin/nginx -s quit完成任务退出
    # ./sbin/nginx -s reload相当于重启(加载配置文件)
    # ./sbin/nginx -t    检查nginx.conf配置文件语法
    # nginx -V    查看版本
    进入tomcat1
    $ sh ./apache-tomcat-7.0.47/bin/startup.sh
    $ tail -n 300 catalina.out 
    # http://192.168.38.131:8080/
    安装keepalived:
    rpm -qa | grep openssl
    rpm -ivh keepalived-1.2.13-5.el6_6.i686.rpm
    rpm -ql keepalived
    service keepalived start
    service keepalived restart
    service keepalived stop
    tail -f /var/log/messages
    ip add show eth0
    vim check_nginx.sh
    http://192.168.38.136/可以访问tomcat
    ./check_nginx.sh//先关闭Nginx
    Nginx代理配置(代理多个tomcat):
    1. server {
      listen 80;
      server_name localhost;
      #charset koi8-r;
      #access_log logs/host.access.log main;
      location /jenkins {
      proxy_pass http://localhost:8082;
      }
      location /go {
      proxy_pass http://localhost:8153;
      }
      error_page 500502503504/50x.html;
      location =/50x.html {
      root html;
      }
      }
    博采众长才能相互印证,故步自封必将粗陋浅薄!
  • 相关阅读:
    LINUX按键驱动程序
    s3c2440地址分配
    Linux内核代码
    C语言初始化
    tftp协议
    ARM工作模式
    Bootstrap3隐藏滑动侧边栏菜单代码特效
    javascript 中slice,substr,substring方法的对比
    vue 的简述
    鼠标移动出自己想要的效果
  • 原文地址:https://www.cnblogs.com/tangwan/p/5860581.html
Copyright © 2011-2022 走看看