也不知道我的系统是否有这些依赖包,试试吧?缺少哪些我就装哪些吧,多踏点坑总是能学到点东西的.
 
获取nginx包
configure --sbin-path=/user/local/nginx/nginx --conf-path=/usr/local/nginx/nginx.conf --pid-path=/usr/local/nginx/nginx.pid
 
报错
./configure: error: the HTTP rewrite module requires the PCRE library.
You can either disable the module by using --without-http_rewrite_module
option, or install the PCRE library into the system, or build the PCRE library
statically from the source with nginx by using --with-pcre=<path> option
 
 
获取pcre包
安装pcre
cd /usr/local/src
wget ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.37.tar.gz
tar -zxvf pcre-8.37.tar.gz
cd pcre-8.34
./configure --prefix=/usr/local/pcre
make
make install
 
报错
configure: error: You need a C++ compiler for C++ support.
 
 
安装gcc
yum install gcc gcc-c++
再次安装pcre,成功安装pcre
 
重新安装nginx
 
./configure --sbin-path=/user/local/nginx/nginx --conf-path=/usr/local/nginx/nginx.conf --pid-path=/usr/local/nginx/nginx.pid
报错
./configure: error: the HTTP gzip module requires the zlib library.
You can either disable the module by using --without-http_gzip_module
option, or install the zlib library into the system, or build the zlib library
statically from the source with nginx by using --with-zlib=<path> option.
 
安装zlib
获取zlib包
[root@bogon src]# tar -zxvf zlib-1.2.11.tar.gz
cd zlib-1.2.11
./configure --prefix=/usr/local/zlib
make && make install
 
重新安装nginx
./configure --sbin-path=/user/local/nginx/nginx --conf-path=/usr/local/nginx/nginx.conf --pid-path=/usr/local/nginx/nginx.pid
 
make && make install
 
启动
[root@bogon nginx]# systemctl start nginx
Failed to start nginx.service: Unit nginx.service failed to load: No such file or directory.
说明安装失败
 
是不是没有安装ssl呢,我查到系统是有安装的,不放心我就再安装一次吧.
./config --prefix=/usr/local --openssldir=/usr/local/ssl
make && make install
./config shared --prefix=/usr/local --openssldir=/usr/local/ssl
make clean
make && make install
 
看来还是照着教程安装才算靠谱
删除zlib pcre
到对应目录运行 make uninstall
 
安装pcre
cd /usr/local/src
wget ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.37.tar.gz
tar -zxvf pcre-8.37.tar.gz
cd pcre-8.34
./configure --prefix=/usr/local/pcre
make
make install
 
安装zlib
获取zlib包
[root@bogon src]# tar -zxvf zlib-1.2.11.tar.gz
cd zlib-1.2.11
./configure --prefix=/usr/local/zlib
make && make install
 
重新安装nginx
./configure --sbin-path=/usr/local/nginx/nginx \
--conf-path=/usr/local/nginx/nginx.conf \
--pid-path=/usr/local/nginx/nginx.pid \
--with-http_ssl_module \
--with-pcre=/usr/local/src/pcre-8.40 \
--with-zlib=/usr/local/src/zlib-1.2.11 \
--with-openssl=/usr/local/src/openssl-1.0.2l
 
[root@bogon nginx-1.12.0]# ./configure --sbin-path=/usr/local/nginx/nginx \
> --conf-path=/usr/local/nginx/nginx.conf \
> --pid-path=/usr/local/nginx/nginx.pid \
local/src/openssl-1.0.2l> --with-http_ssl_module \
> --with-pcre=/usr/local/src/pcre-8.40 \
> --with-zlib=/usr/local/src/zlib-1.2.11 \
> --with-openssl=/usr/local/src/openssl-1.0.2l
 
 
[root@bogon nginx-1.12.0]# make && make install
 
修改/etc/local/nginx/nginx.conf 将lisent商品80改为8080
启动服务:/etc/local/nginx/nginx
 
 
Welcome to nginx!
 
If you see this page, the nginx web server is successfully installed and working. Further configuration is required.
 
For online documentation and support please refer to nginx.org.
Commercial support is available at nginx.com.
 
Thank you for using nginx.
 
 
启动nginx服务
方法一:
/usr/local/nginx/nginx
方法二(-c nginx配置文件地址):
/usr/local/nginx/nginx -c /usr/local/nginx/nginx.conf
 
停止nginx服务
方法一:从容停止
查看进程
[root@bogon nginx]# ps -ef | grep nginx
root 62024 1 0 07:01 ? 00:00:00 nginx: master process /usr/local/nginx/nginx
nobody 62025 62024 0 07:01 ? 00:00:00 nginx: worker process
root 62308 18453 0 07:14 pts/1 00:00:00 grep --color=auto nginx
杀死进程
[root@bogon nginx]# kill -QUIT 62024
 
方法二:快速停止
查看进程
[root@bogon nginx]# ps -ef | grep nginx
root 62358 1 0 07:17 ? 00:00:00 nginx: master process /usr/local/nginx/nginx -c /usr/local/nginx/nginx.conf
nobody 62359 62358 0 07:17 ? 00:00:00 nginx: worker process
root 62463 18453 0 07:20 pts/1 00:00:00 grep --color=auto nginx
杀死进程
[root@bogon nginx]# kill -TERM 62358
或者
[root@bogon nginx]# /usr/local/nginx/nginx -c /usr/local/nginx/nginx.conf
[root@bogon nginx]# ps -ef | grep nginx
root 62473 1 0 07:21 ? 00:00:00 nginx: master process /usr/local/nginx/nginx -c /usr/local/nginx/nginx.conf
nobody 62474 62473 0 07:21 ? 00:00:00 nginx: worker process
root 62476 18453 0 07:21 pts/1 00:00:00 grep --color=auto nginx
[root@bogon nginx]# kill -INT 62473
 
方法三:强制停止
[root@bogon nginx]# pkill -9 nginx
 
感觉这个最好记有没有?
今天简单安装就到这里,明天学一下配置. 

Centos 7 nginx-1.12.0编译安装的更多相关文章

  1. Centos7 编译安装 Nginx PHP Mariadb Memcached 扩展 ZendOpcache扩展 (实测 笔记 Centos 7.3 + Openssl 1.1.0e + Mariadb 10.1.22 + Nginx 1.12.0 + PHP 7.1.4 + Laravel 5.4 )

    环境: 系统硬件:vmware vsphere (CPU:2*4核,内存2G,双网卡) 系统版本:CentOS-7-x86_64-Minimal-1611.iso 安装步骤: 1.准备 1.0 查看硬 ...

  2. CentOS 7.0编译安装Nginx1.6.0+MySQL5.6.19+PHP5.5.14

    准备篇: CentOS 7.0系统安装配置图解教程 http://www.osyunwei.com/archives/7829.html 一.配置防火墙,开启80端口.3306端口 CentOS 7. ...

  3. centos 7.0 编译安装php 7.0.3

    php下载页面 http://cn2.php.net/downloads.php 7.0.3多地区下载页面 http://cn2.php.net/get/php-7.0.3.tar.gz/from/a ...

  4. CentOS 7.0编译安装Nginx1.6.0+MySQL5.6.19+PHP5.5.14方法分享

    一.配置防火墙,开启80端口.3306端口 CentOS 7.0默认使用的是firewall作为防火墙,这里改为iptables防火墙. 1.关闭firewall: systemctl stop fi ...

  5. CentOS 6.6 下源码编译安装MySQL 5.7.5

    版权声明:转自:http://www.linuxidc.com/Linux/2015-08/121667.htm 说明:CentOS 6.6 下源码编译安装MySQL 5.7.5 1. 安装相关工具# ...

  6. Valgrind 3.11.0编译安装

    Valgrind 3.11.0编译安装 Valgrind是一款用于内存调试.内存泄漏检测以及性能分析的软件开发工具. Valgrind遵守GNU通用公共许可证条款,是一款自由软件. 到3.3.0版本为 ...

  7. 新安装和已安装nginx如何添加未编译安装模块/补丁

    新安装和已安装nginx如何添加未编译安装模块/补丁 --http://www.apelearn.com/bbs/forum.php?mod=viewthread&tid=10485& ...

  8. nginx 升级为最新版 nginx -1.12.0

    标签:nginx 公司目前使用的nginx版本比较低(nginx-1.0.12),请网络安全公司做了一下“远程安全评估”,发现有下列漏洞: nginx URI处理安全限制绕过漏洞(CVE-2013-4 ...

  9. 对<< ubuntu 12.04编译安装linux-3.6.10内核笔记>>的修正

    前题: 在前几个月的时候,写了一篇笔记,说的是kernel compile的事情,当时经验不足,虽说编译过了,但有些地方写的有错误--因为当时的理解是有错误的.今天一一更正,记录如下: 前文笔记链接: ...

随机推荐

  1. 上传一个npm包

    1.先创建一个npm账号 https://www.npmjs.com/signup 2.在cmd里输入命令进入项目文件夹 3.使用npm init 命令创建一个package.json(确保nodej ...

  2. 第一次创建svn的项目的使用方法

    1.第一步.在服务器上创建svn项目,将开发人人员你的账号密码添加上去. 2.第二步.开始在本地创建一个文件夹,点文件夹,右键->tortoisSVN->repo-brower 填写svn ...

  3. 关于DOS-BOX的使用方法

    将MASM文件夹里的全部文件拷贝到一个目录下,比如E:\masm下,然后将这个目录挂着为DOSBox的一个盘符下,挂载命令为 Mount c e:\masm 切换到E盘 然后编译,运行

  4. 字符串系列——KMP模板整理

    KMP模板整理 KMP与扩展KMP: /*vs 2017/ vs code以外编译器,去掉windows.h头文件和system("pause");*/ #include<i ...

  5. java学习日志---File实例:实现复制整个文件夹、解决listFiles()为null问题

    需求:将H盘下的所有文件复制到H:/All 文件夹中 思路:使用递归遍历整个目标目录 传入目标路径 判断是否是文件夹 是:调用listFiles()方法,得到File数组,重点内容接着执行1 否:复制 ...

  6. Mybatis中and和or的细节处理

    当一条SQL中既有条件查又有模糊查的时候,偶尔会遇到这样的and拼接问题.参考如下代码: <select id="listSelectAllBusiness"> sel ...

  7. Java 中 break和 continue 的使用方法及区别

    break break可用于循环和switch...case...语句中. 用于switch...case中: 执行完满足case条件的内容内后结束switch,不执行下面的语句. eg: publi ...

  8. save density, pressure, velocity, temperature contour at one slice in xy plane-- paraview with batch Python scripts

    #### import the simple module from the paraviewfrom paraview.simple import *#### disable automatic c ...

  9. 关于React.PropTypes的废除,以及新版本下的react的验证方式

    React.PropTypes是React用来typechecking的一个属性.要在组件的props上运行typechecking,可以分配特殊的propTypes属性: class Greetin ...

  10. Python基础(三) 数据类型

    我们首先要看的是几乎任何语言都具有的数据类型,包括字符串.整型.浮点型以及布尔类型.这些基本数据类型组成了基本控制块,从而创建的Python应用程序. 一.基本结构 1.数值: Python支持不同的 ...