Tomcat+Nginx动静分离

一、安装Nginx

1、安装语言包

[root@localhost ~]# yum -y install pcre-devel zlib-devel gcc gcc-c++
[root@localhost ~]# useradd -M -s /sbin/nologin nginx
[root@localhost ~]# tar zxvf nginx-1.12.2.tar.gz -C /opt

2、配置编译安装

[root@localhost ~]# cd /opt/nginx-1.12.2/
./configure \
--prefix=/usr/local/nginx \
--user=nginx \
--group=nginx \
--with-http_stub_status_module	             //开启stub_ status状态统计模块//
[root@localhost ~]# make && make install
[root@localhost ~]# ln -s /usr/local/nginx/sbin/nginx /usr/local/sbin/            //让系统识别命令

3、检查、启动、重启、停止

[root@localhost ~]# nginx- t		//检查
[root@localhost ~]# nginx		//启动
[root@localhost ~]# killall -1 nginx	//重启
[root@localhost ~]# killall -3 nginx	//停止

yum install elinks -y //安装软件
elinks http://localhost //验证访问,会提示welcome语句

4、制作管理角本

[root@localhost ~]# vim /etc/init.d/nginx
#!/bin/bash
#chkconfig: - 99 20
#description: Nginx Service Control Script
PROG="/usr/local/nginx/sbin/nginx"
PIDF="/usr/local/nginx/logs/nginx.pid"
case "$1" in
     start)
	$PROG
	;;
    stop)
	kill -s QUIT $(cat $PIDF)
	;;
    restart) 
	$0 stop
	$0 start
	;;
    reload)
	kill -s HUP $(cat $PIDF)
	;;
    *)
	echo "Usage: $0 {start |stop|restart |reload}"
	exit 1
esac
exit 0

[root@localhost ~]# chmod +x /etc/init.d/nginx
[root@localhost ~]# chkconfig --add nginx
[root@localhost ~]# chkconfig --level 35 nginx on

在这里插入图片描述

#访问验证
在这里插入图片描述

二、安装tomcat<

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值