Nginx

一、Nginx安装

1、首先安装gcc (编译c程序)、 gcc-c++ (编译c++程序)、 wget (网络下载文件) 工具

[root@localhost ~]# yum -y install gcc gcc-c++ wget

2、从网上下载nginx压缩包

[root@localhost ~]# wget http://nginx.org/download/nginx-1.14.0.tar.gz

3、安装ntpdate工具

[root@localhost ~]# yum -y install ntpdate

4、解压nginx压缩包

[root@localhost ~]# tar -zxvf nginx-1.14.0.tar.gz

  1. 查看nginx-1.14.0目录信息

[root@localhost ~]# cd nginx-1.14.0/

[root@localhost nginx-1.14.0]# ls

auto  CHANGES  CHANGES.ru  conf  configure  contrib  html  LICENSE  Makefile  man  objs  README  src

src目录:存放Nginx的源代码

man目录:存放Nginx的帮助文档

html目录:存放默认网站文件

contrib目录:存放其他机构或组织贡献的文档资料

conf目录:存放Nginx服务器的配置文件

auto目录:存放大量脚本文件和configure脚本程序相关

configure目录:Nginx自动安装脚本,用于检测环境,生成编译代码需要的makefile文件。

CHANGES  CHANGES.ru  LICENSE  README 都是Nginx服务器的相关文件资料

  1. 安装Nginx依赖包pcre-devel、zlib-devel、openssl-devel

[root@localhost ~]# yum -y install pcre-devel openssl-devel

  1. Nginx的编译安装切换到nginx解压目录

[root@localhost ~]# cd nginx-1.14.0

  1. 配置Nginx的编译选项,指定Nginx的安装目录,并使用http_ssl_module模块

[root@localhost nginx1.14.0]# ./configure \

--prefix=/usr/local/nginx \

--with-http_ssl_module

  1. 通过make命令编译和安装Nginx

[root@localhost nginx1.14.0]# make && make install

  1. 启动Nginx 服务命令

[root@localhost ~]# cd/usr/local/nginx/sbin

[root@localhost ~]# ./nginx

上述操作如果成功启动Nginx,则没有任何提示。使用ps命令查看状态

[root@localhost ~]# ps aux | grep nginx

  1. 停止Nginx 服务命令

立即停止服务

[root@localhost sbin]# ./nginx -s stop

从容停止服务

[root@localhost sbin]# ./nginx -s quit

kill 或killall杀死进程

[root@localhost sbin]# kill Nginx主进程的PID

[root@localhost sbin]# killall nginx

二、实现负载均衡

1.进入目录

 2.配置nginx.conf文件

 3.配置完成后重启nginx

 三、配置完nginx后开始构建springboot基本项目

四、实现效果 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值