06 ,nginx 安装,linux 版本 ,登录 :

1 ,nginx 是什么 :

  1. web 服务器
  2. 分享代理服务器

2 ,具体作用 :

  1. 直接支持 : rails ,php
  2. 反向代理 : http
  3. 负载均衡
  4. 右键代理服务器
  5. 前段动静分离

3 ,nginx 优点 :

  1. 稳定
  2. 性能高
  3. 资源占用少
  4. 功能丰富
  5. 模块化
  6. 热部署

4 ,nginx 安装 : linux

  1. 安装依赖 :
    yum install gcc -y
    yum install pcre-devel -y
    yum install zlib -y
    yum install zlib-devel -y
    yum install openssl -y
    yum install openssl-devel -y
  2. 下载 nginx :
    wget http://nginx.org/download/nginx-1.10.2.tar.gz

5 ,解压 :

tar -xzvf nginx-1.10.2.tar.gz -C …/software/

6 ,安装 :

  1. cd /app/software/nginx-1.10.2
  2. ./configure
  3. make
  4. make install

7 ,成功的标志 :

  1. cd /usr/local/
  2. ls
  3. 看到 nginx ,证明安装成功

8 ,启动 nginx :

  1. cd /usr/local/nginx/sbin
  2. ./nginx

9 ,检测进程 :

ps -aux | grep nginx

10 ,成功的标志 :

看到 nginx 的进程

11 ,访问 :

http://161.189.10.185/

12 ,关闭 nginx :

pkill -9 nginx

13 ,编辑主配置文件 : 引入分配置文件

  1. 目的 : 方便维护,每个域名对应一个 conf 文件
  2. 编辑 :
    cd /usr/local/nginx/conf/
    mkdir vhost
    vim nginx.conf
  3. 加入这一句 :
    include vhost/*.conf;
  4. 位置 :
    在这里插入图片描述

14 ,重启 nginx :

cd /usr/local/nginx/sbin/
./nginx -s reload

发布了472 篇原创文章 · 获赞 25 · 访问量 3万+

猜你喜欢

转载自blog.csdn.net/qq_34319644/article/details/104120572