Blogger Information
Blog 291
fans 0
comment 0
visits 349800
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
Centos系统部署nginx1.18.0
Original
761 people have browsed it

镜像下载、域名解析、时间同步请点击 阿里云开源镜像站

一、 安装依赖包

  1. # yum –y install gcc gcc-c++ openssl openssl-devel pcre pcre-devel zlib
  2. zlib-devel

如yum安装依赖包时报错:

file

解决办法:

  1. #~ wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
  2. ##可连外网的情况下,下载一个网络源
  1. #~ sed -i 's/$releasever/7/g' /etc/yum.repos.d/CentOS-Base.repo
  2. ##将整个文件中的$releasever替换为当前的版本号,例如我当前Centos版本号为7
  1. #~ yum repolist
  2. ##显示已启用的yum存储库的列表

或报错 :error: Failed dependencies: krb5-devel(x86-64)

解决办法: 直接yum下载即可

  1. #~ yum –y iinstall krb5-devel
  2. 重新安装依赖包即可

二、安装nginx

找一固定目录上传nginx安装包
rz nginx-1.18.0.tar.gz

  1. #~ tar xzvf nginx-1.18.0.tar.gz ##解压安装包
  2. #~ cd nginx-1.18.0

三、编译安装源码包

  1. #~ ./configure --prefix=/usr/local/nginx-1.18.0/nginx 配置指定安装目录
  2. #~ make && make install 编译安装
  3. #~ echo $? 检验执行结果
  4. 执行完命令后,在指定的安装目录里如果看到了confsbin目录,说明nginx基本安装成功

file

然后进入nginx.conf文件里,修改配置文件

  1. #~ vim conf/nginx.conf

file

保存退出
进入sbin目录中,启动nginx

  1. #~ ./nginx
  2. #~ ps –ef |grep nginx 查看nginx是否启动

直接使用nginx命令,需创建软连接:

  1. ln s /usr/local/nginx-1.18.0/nginx/sbin/nginx /usr/local/bin

本文转自:https://blog.51cto.com/u_15580946/5167979

Statement of this Website
The copyright of this blog article belongs to the blogger. Please specify the address when reprinting! If there is any infringement or violation of the law, please contact admin@php.cn Report processing!
All comments Speak rationally on civilized internet, please comply with News Comment Service Agreement
0 comments
Author's latest blog post