码迷,mamicode.com
首页 > 其他好文 > 详细

30.Nginx集群搭建笔记

时间:2016-09-10 23:52:56      阅读:204      评论:0      收藏:0      [点我收藏+]

标签:

源码安装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服务器        启动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 {
  2. listen 80;
  3. server_name localhost;
  4. #charset koi8-r;
  5. #access_log logs/host.access.log main;
  6. location /jenkins {
  7. proxy_pass http://localhost:8082;
  8. }
  9. location /go {
  10. proxy_pass http://localhost:8153;
  11. }
  12. error_page 500502503504/50x.html;
  13. location =/50x.html {
  14. root html;
  15. }
  16. }
 
 
 
 
 





附件列表

 

30.Nginx集群搭建笔记

标签:

原文地址:http://www.cnblogs.com/tangwan/p/5860581.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!