版本:nginx-1.8.0.tar.gz
 
 
版本:apache-tomcat-6.0.44.tar.gz 
 
1、安装脚本:        

# yum clean all   
# yum makecache
# yum update
 
# yum install wget
# wget -c http://nginx.org/download/nginx-1.7.9.tar.gz
 
# find -name nginx
# yum remove nginx
 
# cd /下载目录
# tar -zxv -f nginx-1.7.9.tar.gz
 
# rm -rf nginx-1.7.9.tar.gz
# mv nginx-1.7.9  /usr/local/nginx
 
# yum install gcc-c++
# yum -y install zlib zlib-devel openssl openssl--devel pcre pcre-devel
 
# cd /usr/local/nginx
# ./configure --prefix=/usr/local/nginx --conf-path=/usr/local/nginx/nginx.conf
# make && make install
 
2、启动/重启/停止/       

启动:# /usr/local/nginx/sbin/nginx
重启:# /usr/local/nginx/sbin/nginx -s reload
停止
#查询nginx主进程号 :ps -ef | grep nginx
#停止进程 :kill -QUIT 主进程号 
#快速停止 :kill -TERM 主进程号 
#强制停止 :pkill -9 nginx
 
3、开机启动,启动脚本        

1、编写开机启动脚本,在/etc/init.d/目录:vi /etc/init.d/nginx

2、更改脚本权限:chmod 775 /etc/init.d/nginx
或:chmod a+x /etc/init.d/nginx     (a+x ==> all user can execute 所有用户可执行)

3、编写脚本内容:
 
################################
#!/bin/bash
# nginx Startup script for the Nginx HTTP Server
# it is v.0.0.2 version.
# chkconfig: - 85 15
# description: Nginx is a high-performance web and proxy server.
#              It has a lot of features, but it's not for everyone.
# processname: nginx
# pidfile: /var/run/nginx.pid
# config: /usr/local/nginx/conf/nginx.conf
nginxd=/usr/local/nginx/sbin/nginx
nginx_config=/usr/local/nginx/conf/nginx.conf
nginx_pid=/var/run/nginx.pid
RETVAL=0
prog="nginx"
# Source function library.
. /etc/rc.d/init.d/functions
# Source networking configuration.
. /etc/sysconfig/network
# Check that networking is up.
[ ${NETWORKING} = "no" ] && exit 0
[ -x $nginxd ] || exit 0
# Start nginx daemons functions.
start() {
if [ -e $nginx_pid ];then
   echo "nginx already running...."
   exit 1
fi
   echo -n $"Starting $prog: "
   daemon $nginxd -c ${nginx_config}
   RETVAL=$?
   echo
   [ $RETVAL = 0 ] && touch /var/lock/subsys/nginx
   return $RETVAL
}
# Stop nginx daemons functions.
stop() {
        echo -n $"Stopping $prog: "
        killproc $nginxd
        RETVAL=$?
        echo
        [ $RETVAL = 0 ] && rm -f /var/lock/subsys/nginx /var/run/nginx.pid
}
# reload nginx service functions.
reload() {
    echo -n $"Reloading $prog: "
    #kill -HUP `cat ${nginx_pid}`
    killproc $nginxd -HUP
    RETVAL=$?
    echo
}
# See how we were called.
case "$1" in
start)
        start
        ;;
stop)
        stop
        ;;
reload)
        reload
        ;;
restart)
        stop
        start
        ;;
status)
        status $prog
        RETVAL=$?
        ;;
*)
        echo $"Usage: $prog {start|stop|restart|reload|status|help}"
        exit 1
esac
exit $RETVAL
#######################
 
4、设置开机启动:chkconfig nginx on
或:vi /etc/rc.local 加入一行 /etc/init.d/nginx start 保存并退出,下次重启会生效。
 
5、这样在控制台就很容易的操作nginx了:查看Nginx当前状态、启动Nginx、停止Nginx、重启Nginx…
/etc/init.d/nginx status
/etc/init.d/nginx start
/etc/init.d/nginx stop
/etc/init.d/nginx restart
 
4、nginx负载均衡配置:集群tomcat      

  

 
 
windows下直接解压,点击nginx.exe即可启动,常用命令如下(.exe可去掉)【此为后台运行方式;windows下nginx不自己注册系统服务,需要依赖第三方工具处理注册表信息比较复杂;】:
cd nginx目录下;
启动:nginx.exe 或双击
停止:nginx.exe -s stop
重新加载:nginx.exe -s reload
退出:nginx.exe -s quit;

nginx安装配置+集群tomcat:Centos和windows环境的更多相关文章

  1. 安装Spark集群(在CentOS上)

    环境:CentOS 6.4, Hadoop 1.1.2, JDK 1.7, Spark 0.7.2, Scala 2.9.3 1. 安装 JDK 1.7 yum search openjdk-deve ...

  2. Centos 安装k8s 集群(单master开发环境)

    本教程是在VM中搭建K8s 所以第一步骤先配置虚拟机的ip 和上网情况详细参考https://www.cnblogs.com/chongyao/p/9209527.html 开始搭建K8s集群 两台机 ...

  3. zookeeper安装 配置集群

    zookeeper下载 http://zookeeper.apache.org/releases.html. 解压 重命名 新建data log两个文件夹配置单个启动 tar -xvf zookeep ...

  4. zookeeper 安装 配置集群

    https://mirrors.tuna.tsinghua.edu.cn/apache/zookeeper/ [root@znode01 src]# tar -xzvf zookeeper--alph ...

  5. KingbaseES V8R6集群部署案例之---Windows环境配置主备流复制(异机复制)

    案例说明: 目前KingbaseES V8R6的Windows版本不支持数据库sys_rman的物理备份,可以考虑通过建立主备流复制实现数据库的异机物理备份.本案例详细介绍了,在Windows环境下建 ...

  6. KingbaseES V8R6集群部署案例之---Windows环境配置主备流复制(同一主机)

    案例说明: 目前KingbaseES V8R6的Windows版本不支持数据库sys_rman的物理备份,可以考虑通过建立主备流复制实现数据库的异机物理备份.本案例详细介绍了,在Windows环境下建 ...

  7. 图文解说:Nginx+tomcat配置集群负载均衡

    图文解说:Nginx+tomcat配置集群负载均衡 博客分类: appserver nginxTomcatUbuntuLinux网络应用  作者:niumd Blog:http://ari.iteye ...

  8. 转】Nginx+tomcat配置集群负载均衡

    原博文出自于:http://blog.csdn.net/bruce_6/article/details/38228299         感谢! 相信很多人都听过nginx,这个小巧的东西慢慢地在吞食 ...

  9. 配置集群Nginx+Memcached+Tomcat集群配置

    上班之余抽点时间出来写写博文,希望对新接触的朋友有帮助.今天在这里和大家一起学习一下配置集群 1.   Nginx Nginx是通过将多个Web Server绑定到同一个IP地址下,以实现多个WebS ...

随机推荐

  1. DBA Scripts

    标记一下,慢慢研究 http://www.oracle-base.com/dba/scripts.php Monitoring access.sql active_sessions.sql cache ...

  2. RecyclerView 实现横向滚动效果

    我相信很久以前,大家在谈横向图片轮播是时候,优先会选择具有HorizontalScrollView效果和ViewPager来做,不过自从Google大会之后,系统为我们提供了另一个控件Recycler ...

  3. Java Map 及相应的一些操作总结

    Map是我们在开发的时候经常会用到的,大致有以下几个操作,其中putAll方法是针对集合而言的操作,故不再进行说明,下面请看一下常用的知识点吧,尤其是keySet和Values两个方法及相应值的获取方 ...

  4. Linux Shell -- 无网不利

    这篇文章中我介绍几个非常实用的和网络相关的命令 一.ifconfig 这个命令在Windows下被"翻译为ipconfig",它用于显示网络接口,子网掩码等详细信息. 注:在每个系 ...

  5. close()方法应该在finally语句中调用吗?

    翻译人员: 铁锚 翻译时间: 2013年12月20日 原文链接: Should .close() be put in finally block or not? 下面列出了关闭输出流(output w ...

  6. C++异常处理基本思想

    传统错误处理机制 通过函数返回值来处理错误. 异常处理的基本思想 1)C++的异常处理机制使得异常的引发和异常的处理不必在同一个函数中,这样底层的函数可以着重解决具体问题,而不必过多的考虑异常的处理. ...

  7. How Many Processes Should Be Set For The Receiving Transaction Manager (RTM)

    In this Document   Goal   Solution   References APPLIES TO: Oracle Inventory Management - Version 10 ...

  8. 【Android 应用开发】Android - 按钮组件详解

    总结了Android中常用的按钮用法 示例源码下载地址 : -- CSDN :  http://download.csdn.net/detail/han1202012/6852091 -- GitHu ...

  9. Customer Form Issue: Automatic Matching Rule Set Defaults Value AutoRuleSet-1

    In this Document   Symptoms   Changes   Cause   Solution   References APPLIES TO: Oracle Receivables ...

  10. 关于Service中bindService注意的几个问题

    最近有用到Activity需要不断的从Service中获取数据,第一个想法肯定就是通过bind回调机制了,有几点概念模糊特此记录下: 单独使用bindService(),unbindService() ...