下载nginx包

nginx-1.10.3.tar.gz

解压

[root@localhost src]# tar -zxvf nginx-1.10.3.tar.gz
[root@localhost src]# cd nginx-1.10.3
[root@localhost nginx-1.10.3]# ./configure
checking for OS
+ Linux 3.10.0-229.el7.x86_64 x86_64
checking for C compiler ... not found
./configure: error: C compiler cc is not found

安装gcc编译环境

[root@localhost nginx-1.10.3]# yum install gcc-c++
已安装:
gcc-c++.x86_64 0:4.8.3-9.el7
作为依赖被安装:
cpp.x86_64 0:4.8.3-9.el7 gcc.x86_64 0:4.8.3-9.el7 glibc-devel.x86_64 0:2.17-78.el7
glibc-headers.x86_64 0:2.17-78.el7 kernel-headers.x86_64 0:3.10.0-229.el7 libmpc.x86_64 0:1.0.1-3.el7
libstdc++-devel.x86_64 0:4.8.3-9.el7 mpfr.x86_64 0:3.1.1-4.el7

安装依赖包

如果直接安装会包错
./configure: error: the HTTP rewrite module requires the PCRE library.
[root@localhost nginx-1.10.3]# yum install pcre pcre-devel -y
[root@localhost nginx-1.10.3]# yum install zlib zlib-devel -y
[root@localhost nginx-1.10.3]# yum install openssl openssl--devel -y

安装nginx

#配置检测 指定安装目录
[root@localhost nginx-1.10.3]# ./configure --prefix=/usr/local/nginx
Configuration summary
+ using system PCRE library
+ OpenSSL library is not used
+ using builtin md5 code
+ sha1 library is not found
+ using system zlib library nginx path prefix: "/usr/local/nginx"
nginx binary file: "/usr/local/nginx/sbin/nginx"
nginx modules path: "/usr/local/nginx/modules"
nginx configuration prefix: "/usr/local/nginx/conf"
nginx configuration file: "/usr/local/nginx/conf/nginx.conf"
nginx pid file: "/usr/local/nginx/logs/nginx.pid"
nginx error log file: "/usr/local/nginx/logs/error.log"
nginx http access log file: "/usr/local/nginx/logs/access.log"
nginx http client request body temporary files: "client_body_temp"
nginx http proxy temporary files: "proxy_temp"
nginx http fastcgi temporary files: "fastcgi_temp"
nginx http uwsgi temporary files: "uwsgi_temp"
nginx http scgi temporary files: "scgi_temp"
#编译
[root@localhost nginx-1.10.3]# make
#安装
[root@localhost nginx-1.10.3]# make install

启动nginx

#启动
[root@localhost /]# /usr/local/nginx/sbin/nginx
#重启
[root@localhost /]# /usr/local/nginx/sbin/nginx -s reload
#关闭
[root@localhost /]# /usr/local/nginx/sbin/nginx -s stop
#启动成功
[root@localhost nginx]# ps -axu|grep nginx
root 17003 0.0 0.0 20432 604 ? Ss 22:11 0:00 nginx: master process /usr/local/nginx/sbin/nginx #查看防火墙状态
[root@localhost nginx]# firewall-cmd --state
#关闭防火墙服务
[root@localhost nginx]# systemctl stop firewalld

开机启动

[root@localhost nginx]# vim /lib/systemd/system/nginx.service
[Unit]
Description=nginx
After=network.target [Service]
Type=forking
ExecStart=/usr/local/nginx/sbin/nginx
ExecReload=/usr/local/nginx/sbin/nginx -s reload
ExecStop=/usr/local/nginx/sbin/nginx -s quit
PrivateTmp=true [Install]
WantedBy=multi-user.target #设置开机启动
[root@localhost nginx]# systemctl enable nginx.service
#停止开机自启动
[root@localhost nginx]# systemctl disable nginx.service

linux入门常用指令2.安装nginx的更多相关文章

  1. linux入门常用指令3.安装mysql

    下载安装包 MySQL-5.6.42-1.el6.x86_64.rpm-bundle_redhat [root@localhost src]# mkdir mysql [root@localhost ...

  2. Linux入门常用指令

    linux获取硬盘和目录大小的命令 df命令 Linux下可以用df命令获取硬盘的使用情况,通过man可以获取df命令的详细情况.df命令经常用的参数为: a:显示全部的档案系统和各分割区的磁盘使用情 ...

  3. linux入门常用指令4.挂载数据盘

    挂载硬盘 #查看当前分区情况 [root@localhost ~]# lsblk NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT sdb 8:16 0 5G 0 dis ...

  4. linux入门常用指令1.配置本地yum源

    创建光盘挂载点 [root@localhost /]# mkdir /mnt/cdrom 挂载光盘 #挂载光盘 [root@localhost /]# mount /dev/cdrom /mnt/cd ...

  5. 在Linux和Windows系统上安装Nginx服务器的教程

    在Linux和Windows系统上安装Nginx服务器的教程  1.在CentOS系统上安装Nginx 在 CentOS6 版本的 EPEL 源中,已经加入了 nginx 的 rpm 包,不过此 RP ...

  6. (转)Linux最常用指令及快捷键 Linux学习笔记

    Linux最常用指令及快捷键 Linux学习笔记 原文:http://blog.csdn.net/yanghongche/article/details/50827478 [摘自 鸟叔的私房菜]--转 ...

  7. Linux文件常用指令

    目录 Linux文件常用指令 1.pwd 显示当前目录 2.cd 切换目录 3.mkdir 创建目录 4.touch 修改或创建文件 5.ls 显示目录下的内容 6.cat 查看文件信息 7.echo ...

  8. Linux入门50指令

    1, mkdir创建目录 make directory 可以带着路径,在什么位置创建什么目录 如:mkdir /etc/date  在目录etc下创建date目录 重要参数 –p 递归创建,mkdir ...

  9. linux软件管理之------编译安装nginx服务器并手动编写自动化运行脚本

    红帽系列的 linux软件管理分为三类:1. rpm 安装软件.2. yum 安装软件.3. 源码包编译安装.前面两种会在相关专题给出详细讲解.源码包的编译安装是非常关键的,我们知道linux的相关版 ...

随机推荐

  1. idea-配置文件提示红色

    Idea建立spring配置文件首行红色 提示URI is not registered 复制出现红色字体的路径...File -  Settings  - schemas and DtDs 点击加号 ...

  2. java中如何在键盘中输入一串数字然后存入数组中?

    import java.util.Scanner; public class Tset { public static void main(String[] args) { System.out.pr ...

  3. centos(linux)--vsftpd配置

    1.安装 执行 yum -y install vsftpd 注:(1)是否使用sudo权限根据个人的具体情况 (2)rpm -qa | grep vsftpd 可以通过这个检查是否已经安装vsftpd ...

  4. python3中django-admin找不到core的解决方法

    今天在测试django-admin startproject mysite时,出现以下问题: ImportError: No module named django.core 在执行此命令之前,我将d ...

  5. XKC's basketball team【线段树查询】

    XKC , the captain of the basketball team , is directing a train of nn team members. He makes all mem ...

  6. upw,c#,代码实现关闭,重启应用

    微软为uwp直接提供了这些API,可以很容易的直接进行调用 关闭 using Windows.ApplicationModel.Core; CoreApplication.Exit(); or usi ...

  7. ubuntu18下Docker运行springboot项目

    1.springboot项目打成jar包 mvn install 2.编写Dockerfile # 基础镜像使用java FROM java:8 # 作者 #MAINTAINER sk # VOLUM ...

  8. php实现算法

    二分法查找(已排序) @params  $arr 查找的数组  $start 开始查找的下标  $end 结束查找的下标  $value 查找的值 function bin_search($arr,$ ...

  9. 消息服务百科全书——为什么使用MQ

    为什么要使用MQ?有如下几个好处: 解耦 在项目启动之初来预测将来项目会碰到什么需求,是极其困难的.消息系统在处理过程中间插入了一个隐含的.基于数据的接口层,两边的处理过程都要实现这一接口.这允许你独 ...

  10. 解决低版本IE关于html5新特性的兼容性问题html5shiv.js和Respond.js,以及excanvas.js解决低版本IE不支持canvas的问题

    插件:html5shiv.js 让IE9以下版本支持html5新标签,git地址https://github.com/aFarkas/html5shiv 用于解决IE9以下版本浏览器对HTML5新增标 ...