下载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. MLN 讨论 —— inference

    We consider two types of inference: finding the most likely state of the world consistent with some ...

  2. Data - 数据挖掘的基础概念

    主要内容来自于<微信公众号:程SIR说> 1 数据挖掘 数据挖掘(Data Mining,简称DM),是指从大量的数据中,挖掘出未知的且有价值的信息和知识的过程. 数据挖掘是一门交叉学科, ...

  3. Flutter 移动端屏幕适配方案和制作

    flutter_screenutil插件 flutter 屏幕适配方案,让你的UI在不同尺寸的屏幕上都能显示合理的布局! 注意:此插件仍处于开发阶段,某些API可能尚未推出. 安装依赖: 安装之前请查 ...

  4. 如何做一个项目v2.ppt

    链接:https://pan.baidu.com/s/159GQsYK9BcQad3h1CyVUYg 提取码:ivcj 复制这段内容后打开百度网盘手机App,操作更方便哦

  5. 【ARM-LInux开发】如何运行wayland

    Running Wayland 原文:https://jan.newmarch.name/Wayland/RunningWayland/ skip table of contents Show tab ...

  6. java 访问数据库公共类

    package com.javaweb.mvc; import java.sql.*; /** * @author 公共数据访问类 * * Statement 和 PreparedStatement之 ...

  7. pytorch API中sgd.py的学习记录

    参考:PyTorch与caffe中SGD算法实现的一点小区别 其中公式(3)(4)的符号有问题 变量对应表 程序 参考文章 buf v momentum μ d_p Δf(θ) lr ξ p θ

  8. js穿梭框;将两个table中的数据选中移动

    将table中选中的数据移动到右边: 点击一行中的任意一个位置,使其选中: 注:attr()和prop()都是jquery的方法: .attr() : 获取匹配的元素集合中的第一个元素的属性的值 或 ...

  9. Zabbix的history相关数据表数据太大,执行表分区操作过程

    一.查询zabbix数据库大小 mysql> select table_schema, concat(truncate(sum(data_length)/1024/1024,2),' mb') ...

  10. MySQL主从同步报错1507

    mysql 从库上手动删除partiton后,主库未做修改.后期主库上删除partiton后,出现问题. 故障现场 Last_Errno: 1507 Last_Error: Error 'Error ...