当前位置: 首页 > news >正文

Linux系统_Centos7下安装Nginx

2019独角兽企业重金招聘Python工程师标准>>> hot3.png

下载Nginx
wget http://nginx.org/download/nginx-1.15.5.tar.gz
解压
tar -xzvf nginx-1.15.5.tar.gz 

生成Makefile,为下一步的编译做准备(可以根据需要删减参数)

./configure --with-http_ssl_module --with-http_v2_module --with-http_realip_module --with-http_stub_status_module --with-stream  --with-stream_ssl_module --with-pcre

安装出现的问题
hecking for C compiler ... not found
./configure: error: C compiler cc is not found

异常:缺失gcc
解决方案
yum -y install gcc gcc-c++ autoconf automake make

异常:缺失PCRE

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 
解决
yum -y install pcre-devel

异常:缺失OpenSSL

 error: SSL modules require the OpenSSL library.
You can either do not enable the modules, or install the OpenSSL library
into the system, or build the OpenSSL library statically from the source
with nginx by using --with-openssl=<path> option
解决:
yum -y install openssl openssl-devel

编译安装
make && make install


按指定配置文件启动Nginx
nginx -c /usr/local/nginx/conf/nginx.conf 
停止操作是通过向nginx进程发送信号来进行的
步骤1:查询nginx主进程号ps -ef | grep nginx
在进程列表里 面找master进程,它的编号就是主进程号了。
步骤2:发送信号

从容停止Nginx:
kill -QUIT 主进程号  
例如:kill -QUIT 16391

快速停止Nginx:
kill -TERM 主进程号  

强制停止Nginx:
kill -9 主进程号  

平滑重启

如果更改了配置就要重启Nginx,要先关闭Nginx再打开?不是的,可以向Nginx 发送信号,平滑重启。
平滑重启命令:
kill -HUP 住进称号或进程号文件路径  
或者使用
/usr/nginx/sbin/nginx -s reload  
注意,修改了配置文件后最好先检查一下修改过的配置文件是否正确,
以免重启后Nginx出现错误影响服务器稳定运行。判断Nginx配置是否正确命令如下:
nginx -t -c /usr/nginx/conf/nginx.conf 
或者
/usr/nginx/sbin/nginx -t 

使用浏览器访问localhost,出现如下页面说明安装成功

153fa0af6a6b915c8cfc26578d44bc1cdfd.jpg

转载于:https://my.oschina.net/sky2008/blog/2248949

相关文章:

  • 源码安装Apache服务器遇到的问题及解决方法
  • 优秀互联网高级测试工程师应该具备的能力
  • raid5实现原理
  • Go 可变参数和切片
  • Tomcat7 catalina.out 日志分割
  • storm drpc实例
  • 监控CPU(一)
  • RIP
  • Lintcode104 Merge k Sorted Lists solution 题解
  • jQuery基础一
  • heartbeat主配置文件
  • Mysql5.6到5.7升级需要以下操作
  • GDI+绘制极坐标图(Polar Diagram)
  • RHEL7/CentOS7 PXE+Kickstart自动化系统安装
  • Netty环境搭建(源码死磕2)
  • __proto__ 和 prototype的关系
  • Android开发 - 掌握ConstraintLayout(四)创建基本约束
  • Android优雅地处理按钮重复点击
  • Computed property XXX was assigned to but it has no setter
  • conda常用的命令
  • javascript 哈希表
  • laravel5.5 视图共享数据
  • PAT A1050
  • SAP云平台里Global Account和Sub Account的关系
  • underscore源码剖析之整体架构
  • 缓存与缓冲
  • 前端_面试
  • 微信端页面使用-webkit-box和绝对定位时,元素上移的问题
  • 再次简单明了总结flex布局,一看就懂...
  • ​人工智能之父图灵诞辰纪念日,一起来看最受读者欢迎的AI技术好书
  • $forceUpdate()函数
  • (16)UiBot:智能化软件机器人(以头歌抓取课程数据为例)
  • (PHP)设置修改 Apache 文件根目录 (Document Root)(转帖)
  • (Redis使用系列) Springboot 使用redis的List数据结构实现简单的排队功能场景 九
  • (二)斐波那契Fabonacci函数
  • (入门自用)--C++--抽象类--多态原理--虚表--1020
  • (转载)VS2010/MFC编程入门之三十四(菜单:VS2010菜单资源详解)
  • *2 echo、printf、mkdir命令的应用
  • .axf 转化 .bin文件 的方法
  • .NET BackgroundWorker
  • .NET Framework .NET Core与 .NET 的区别
  • .NET Framework 服务实现监控可观测性最佳实践
  • .NET国产化改造探索(一)、VMware安装银河麒麟
  • .NET与 java通用的3DES加密解密方法
  • // an array of int
  • @SpringBootApplication 包含的三个注解及其含义
  • [2009][note]构成理想导体超材料的有源THz欺骗表面等离子激元开关——
  • [ACM] hdu 1201 18岁生日
  • [Apio2012]dispatching 左偏树
  • [AutoSar]BSW_OS 02 Autosar OS_STACK
  • [BIZ] - 1.金融交易系统特点
  • [C#C++]类CLASS
  • [C#基础知识系列]专题十七:深入理解动态类型
  • [C++]STL之map
  • [CC2642r1] ble5 stacks 蓝牙协议栈 介绍和理解