参考 https://www.cnblogs.com/liujuncm5/p/6713784.html

Nginx 是 C语言 开发

一. gcc 安装
安装 nginx 需要先将官网下载的源码进行编译,编译依赖 gcc 环境,如果没有 gcc 环境,则需要安装:

yum install gcc-c++

二. PCRE pcre-devel 安装

PCRE(Perl Compatible Regular Expressions) 是一个Perl库,包括 perl 兼容的正则表达式库。nginx 的 http 模块使用 pcre 来解析正则表达式,所以需要在 linux 上安装 pcre 库,pcre-devel 是使用 pcre 开发的一个二次开发库。nginx也需要此库。命令:

yum install -y pcre pcre-devel

三. zlib 安装
zlib 库提供了很多种压缩和解压缩的方式, nginx 使用 zlib 对 http 包的内容进行 gzip ,所以需要在 Centos 上安装 zlib 库。

yum install -y zlib zlib-devel

四. OpenSSL 安装
OpenSSL 是一个强大的安全套接字层密码库,囊括主要的密码算法、常用的密钥和证书封装管理功能及 SSL 协议,并提供丰富的应用程序供测试或其它目的使用。
nginx 不仅支持 http 协议,还支持 https(即在ssl协议上传输http),所以需要在 Centos 安装 OpenSSL 库。

yum install -y openssl openssl-devel

使用wget命令下载Nginx(没有wget就需要安装一下    yum -y install wget)版本可以自己选择

wget -c https://nginx.org/download/nginx-1.12.0.tar.gz

或者通过官网下载

1.直接下载.tar.gz安装包,地址:https://nginx.org/en/download.html

解压

tar -zxvf nginx-1.12..tar.gz
cd nginx-1.12.

配置

其实在 nginx-1.12.0 版本中你就不需要去配置相关东西,默认就可以了。当然,如果你要自己配置目录也是可以的。
1.使用默认配置

./configure

注:将临时文件目录指定为/var/temp/nginx,需要在/var下创建temp及nginx目录

编译安装

make
make install

查找安装路径:

whereis nginx

命令启动,停止,等。。。。

./nginx --启动
./nginx -s stop --停止
./nginx -s quit
./nginx -s reload

查看是否运行

ps -A | grep nginx

如果有返回 则证明已开启

最后通过配置文件 查看端口一般默认路径在/usr/local/nginx/conf/nginx.conf

具体配置文件详解可以百度

centos 7 安装nginx并启动(笔记)的更多相关文章

  1. 删:Centos 7安装Nginx 1.8

    [CentOS 7] 安装nginx! 首先进行 nginx yum Nginx安装记录 注意:如果用源码安装,nginx配置时需要指定--with-pcer对应的压缩包路径,如果使用二进制安装不需要 ...

  2. linux/centos下安装nginx(rpm安装和源码安装)详细步骤

    Centos下安装nginx rpm包                                                                                 ...

  3. CentOS 7安装nginx

    CentOS 7安装nginx 参考网上其他文章做的 安装Nginx 我们从nginx官方的RPM源来安装一个预构建的稳定版本的nginx包. rpm --import http://nginx.or ...

  4. CentOS 7 安装 Nginx 配置反向代理

    Linux使用Nginx Yum存储库上安装Nginx,适用于Red Hat Enterprise Linux和CentOS系统. 1.添加设置Nginx Yum存储库 在CentOS中首次安装Ngi ...

  5. Centos 在线安装 nginx

    centos 在线安装 nginx 安装nginx ​ 参考文档: http://nginx.org/en/linux_packages.html 中的RHEL/CentOS章节,按照步骤安装repo ...

  6. CentOS下安装Nginx并添加nginx_upload_module

    安装前,最好能保证依赖的系统软件已经升级.    yum update CentOS上安装Nginx,如果只是简单安装,不附加其他第三方模块,一句话可以搞定:    yum install nginx ...

  7. linux centos7 安装nginx并启动

    Linux下安装Nginx完整教程及常见错误解决方案:https://blog.csdn.net/chenxiaochan/article/details/63688346 CentOS 7 安装Ng ...

  8. CentOS 下 安装 nginx 执行配置命令 ./configure 报错

    CentOS 下 安装 nginx 执行配置命令 ./configure --prefix=/opt/nginx --sbin-path=/usr/bin/nginx 时提示以下错误: checkin ...

  9. Linux(Centos)之安装Nginx及注意事项

    1.Nginx的简单说明 a.  Nginx是一个高性能的HTTP和反向代理服务器,也是一个IMAP/POP3/SMTP服务器,期初开发的目的就是为了代理电子邮件服务器室友:Igor Sysoev开发 ...

随机推荐

  1. Linux基础及常用指令

    1.Linux目录结构 bin(usr/bin,user/local/bin) #存放常用指令,如cp.cat.chown等 sbin(usr/sbin,user/local/sbin) #高权限指令 ...

  2. Git删除某个文件夹或整个仓库

    删除仓库: 进入仓库,选择settting: 拉到最下面,有个Danger Zone,里面有删除仓库选项: 输入仓库名称,即可删除: 删除某个文件:删除文件和文件夹只能用命令行删除. 如果直接git ...

  3. AOP通知类型

    AOP通知类型 前置通知 在目标方法执行之前进行操作 后置通知 在目标方法执行之后 进行操作 环绕通知 在目标方法执行之前 和之后进行操作 public Object arount() 异常抛出通知 ...

  4. 忘记zip密码咋办?python在手密码我有

    整理资料时发现几个 zip 文件的密码忘记了,于是尝试用python暴力破解 首先是读取和解压zip文件,使用 zipfile 库 import zipfile z = zipfile.ZipFile ...

  5. Java-Maven(十二):idea多项目:common module进行compiler和install正常,运行domain-perf module提示:Could not resolve dependencies for project

    前提: product项目下有三个module,分别是: driver module domain-perf module common module 问题: driver 和 domain-perf ...

  6. 系统树图 | Dendrogram construction | Phylogenetic Analysis

    Molecular Architecture of the Mouse Nervous System 表示亲缘关系的树状图解 先看文章里是怎么做的: Dendrogram construction A ...

  7. python list 和 tuple详解

    list------------------------------------------------------------------------ Python内置的一种数据类型是列表:list ...

  8. hive中function函数查询

    1. desc function [函数名] desc function xpath; 查询用法: 2. desc function extended [函数名] desc function exte ...

  9. sass、less和stylus 相同与不同

    sass.less和stylus的安装使用和入门实践 https://www.jianshu.com/p/1eaf366814e2 stylus 基础教程 https://blog.csdn.net/ ...

  10. [LeetCode] 167. Two Sum II - Input array is sorted 两数和 II - 输入是有序的数组

    Given an array of integers that is already sorted in ascending order, find two numbers such that the ...