1. 下载niginx的 tar包

下载路径

  1. http://nginx.org/en/download.html

也可以直接使用命令下载

  1. wget http://nginx.org/download/nginx-1.15.1.tar.gz

2. 下载目录下解压缩

  1. tar -zxvf nginx-1.15.1.tar.gz

3. cd 到目录里面进行处理

  1. ./configure

4. 安装时会报错 主要有:

  1. ./configure: error: the HTTP rewrite module requires the PCRE library.
  2. You can either disable the module by using --without-http_rewrite_module
  3. option, or install the PCRE library into the system, or build the PCRE library
  4. statically from the source with nginx by using --with-pcre=<path> option.
  5.  
  6. 需要pcre
  7.  
  8. ./configure: error: the HTTP gzip module requires the zlib library.
  9. You can either disable the module by using --without-http_gzip_module
  10. option, or install the zlib library into the system, or build the zlib library
  11. statically from the source with nginx by using --with-zlib=<path> option.
  12.  
  13. 需要zlib

一般linux里面安装了 prce和 zlib 但是没有安装devel 包 需要进行安装

  1. yum install -y prce-devel
  2. yum install -y zlib-devel

5. 再次执行 ./confiure命令成功

反馈安装信息

  1. Configuration summary
  2. + using system PCRE library
  3. + OpenSSL library is not used
  4. + using system zlib library
  5.  
  6. nginx path prefix: "/usr/local/nginx"
  7. nginx binary file: "/usr/local/nginx/sbin/nginx"
  8. nginx modules path: "/usr/local/nginx/modules"
  9. nginx configuration prefix: "/usr/local/nginx/conf"
  10. nginx configuration file: "/usr/local/nginx/conf/nginx.conf"
  11. nginx pid file: "/usr/local/nginx/logs/nginx.pid"
  12. nginx error log file: "/usr/local/nginx/logs/error.log"
  13. nginx http access log file: "/usr/local/nginx/logs/access.log"
  14. nginx http client request body temporary files: "client_body_temp"
  15. nginx http proxy temporary files: "proxy_temp"
  16. nginx http fastcgi temporary files: "fastcgi_temp"
  17. nginx http uwsgi temporary files: "uwsgi_temp"
  18. nginx http scgi temporary files: "scgi_temp"

6. 执行 make 和 make install 进行安装

  1. make and make install

9. 创建软连接

  1. ln /usr/local/nginx/sbin/nginx /usr/local/bin/nginx

10. 直接启动

  1. nginx

遇到报错如图示时

  1. nginx: [emerg] bind() to 0.0.0.0: failed (: Address already in use)
  2. nginx: [emerg] bind() to 0.0.0.0: failed (: Address already in use)
  3. nginx: [emerg] bind() to 0.0.0.0: failed (: Address already in use)
  4. nginx: [emerg] bind() to 0.0.0.0: failed (: Address already in use)
  5. nginx: [emerg] bind() to 0.0.0.0: failed (: Address already in use)
  6. nginx: [emerg] still could not bind()

11. 修改配置文件

  1. 查看配置文件位置
  2.  
  3. nginx -t
    结果为

nginx: the configuration file /usr/local/nginx/conf/nginx.conf syntax is ok
nginx: configuration file /usr/local/nginx/conf/nginx.conf test is successful

修改配置文件

  1. vim /usr/local/nginx/conf/nginx.conf

将端口绑定修改一下

再次启动即可

Linux 下安装nginx的总结 (之前写的有问题))的更多相关文章

  1. 【云服务器部署】---Linux下安装nginx

    [云服务器部署]---Linux下安装nginx 之前两篇,分别讲了:Linux下安装MySQL  和  springboot项目部署云服务器 nginx安装也是挺简单的.具体步骤如下: 第一步,下载 ...

  2. linux下安装nginx及初步认识

    linux下安装配置nginx nginx:是一个高性能的反向代理服务器正向代理代理的是客户端,反向代理代理的是服务端. 这里以nginx-1.12.2版本为例子 1.首先去官网下载nginx-1.1 ...

  3. linux 下 安装nginx及压力测试

    linux 编译安装nginx,配置自启动脚本 下载nginx: wget http://nginx.org/download/nginx-1.8.0.tar.gz下载openssl : wget h ...

  4. linux 下安装 nginx

    安装nginx版本为1.7.5 一.下载nginx 官方地址:http://www.nginx.org/ 下载地址:http://nginx.org/download/ Nginx官网提供了三个类型的 ...

  5. Linux下安装Nginx并配置一个图片服务器

    首先安装nginx安装环境 nginx是C语言开发,建议在linux上运行,本教程使用Centos6.5作为安装环境. gcc 安装nginx需要先将官网下载的源码进行编译,编译依赖gcc环境,如果没 ...

  6. linux下安装nginx和配置

    1.系统:centos6.8 2.安装准备: 安装nginx前,我们首先要确保系统安装了g++.gcc.openssl-devel.pcre-devel和zlib-devel软件,可通过如图所示命令进 ...

  7. linux下安装nginx+php+mysql环境 详细教程

    话不多说上代码 linux环境:centos 7.0 64位 nginx:nginx-1.8.0.tar.gz php: php-7.1.1.tar.gz mysql: mysql-5.6.21.ta ...

  8. Linux下安装Nginx并实现socket代理

    nginx可以使用各平台的默认包来安装,本文是介绍使用源码编译安装,包括具体的编译参数信息. 正式开始前,编译环境gcc g++ 开发库之类的需要提前装好,这里默认你已经装好. ububtu平台编译环 ...

  9. Linux下安装Nginx服务器

    安装Nginx之前,首先要安装好编译环境gcc和g++,然后以CentOS为例安装Nginx,安装Nginx需要PRCE库.zlib库和ssl的支持,除了ssl外其他的我们都是去官网下载: Nginx ...

随机推荐

  1. C语言中几种类型所占字节数

    其实C标准并没有具体给出规定哪个基本类型应该是多少个字节数,而且这个也与OS.编译器有关,比如同样是在32位操作系统,VC++的编译器下int类型为4个字节,而在tuborC下则是2个字节. 下面给出 ...

  2. Ubuntu双系统无法挂载Windows10 硬盘的解决方法

    我的电脑是在Windows 10下安装的Ubuntu 14.04双系统,今天进入Ubuntu系统访问Windows 10 磁盘,出现如下错误: Error mounting /dev/sda1 at ...

  3. scapy学习笔记(4)简单的sniffing 嗅探

    转载请注明:@小五义:http://www.cnblogs/xiaowuyi 利用sniff命令进行简单的嗅探,可以抓到一些简单的包.当不指定接口时,将对每一个接口进行嗅探,当指定接口时,仅对该接口进 ...

  4. python:'ascii' codec can't encode character

    python默认的编码是ascii,当程序中出现非ascii编码时,python的处理常常会报这样的错,python没办法处理非ascii编码的, 此时需要自己设置python的默认编码,一般设置为u ...

  5. Spark内部流程图

    转载自:https://blog.csdn.net/refuil/article/details/52055104

  6. 【C/C++】1~20的阶乘之和

    一. 前情   能点进这篇文章的,想必也已经知道了C语言和C++语言,以及阶乘的定义,所以在此不赘述了.SUM(1!~20!)这个问题是我在大一学C语言时的一个小题,最近又要把编译器装回来,所以装完之 ...

  7. MVVM Light Toolkit使用指南

    原文:MVVM Light Toolkit使用指南 原文地址:  https://blog.csdn.net/ldld1717/article/details/77040077 概述 MVVM Lig ...

  8. 奔跑吧Linux

    刚拿到MiZ702,就被他的"外貌"深深的吸引,核心板加底板的形式让她看上去,强大而神秘-- 华丽的外表之下是否有着与之相当的内含呢,我们拿Linux将其检验一番! 板载的TF卡里 ...

  9. Scala学习(二)--- 控制结构和函数

    控制结构和函数 摘要: 本篇主要学习在Scala中使用条件表达式.循环和函数,你会看到Scala和其他编程语言之间一个根本性的差异.在Java或C++中,我们把表达式(比如3+4)和语句(比如if语句 ...

  10. [CF917D]Stranger Trees[矩阵树定理+解线性方程组]

    题意 给你 \(n\) 个点的无向完全图,指定一棵树 \(S\),问有多少棵生成树和这棵树的公共边数量为 \(k\in[0,n-1]\) \(n\leq 100\) 分析 考虑矩阵树定理,把对应的树边 ...