先去官网下载linux.tar.gz包 http://nginx.org/en/download.html
 
传到linxu中
解压tar包
在软件包nginx-1.15.9目录下对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-http_stub_status_module --with-stream
执行以上命令,提示这个信息:说明没有安装编译器
checking for OS
 + Linux 3.10.0-957.el7.x86_64 x86_64
checking for C compiler ... not found
./configure: error: C compiler cc is not found
解决:yum -install gcc
在执行以上命令提示这个信息
./configure: 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
 
配置执行成功:
Configuration summary
  + using system PCRE library
  + using system OpenSSL library
  + using system zlib library
  nginx path prefix: "/usr/local/nginx"
  nginx binary file: "/usr/local/nginx/nginx"
  nginx modules path: "/usr/local/nginx/modules"
  nginx configuration prefix: "/usr/local/nginx"
  nginx configuration file: "/usr/local/nginx/nginx.conf"
  nginx pid file: "/usr/local/nginx/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"
执行编译:make
编译安装:make install
到NGINX目录下启动:./nginx
提示以下信息:
nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)
nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)
nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)
nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)
nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)
nginx: [emerg] still could not bind()
原因:可能是进程已经启动,或者是端口被占用
解决方式:先查看进程是否启动:ps -ef |grep nginx。如未启动,就是原因二。
原因二解决方式:到安装目录下打开配置文件:vi nginx.conf。将修改为8080,再次启动即可
启动成功后浏览器中输入ip和端口访问。
提示“无法访问此网站”
原因:linux中启动了防火墙,可通过:systemctl status firewalld命令查看防火墙状态
解决方式:systemctl stop firewalld 使用该命令禁用防火墙
再次访问ok

全新linux中通过编译方式安装nginx的更多相关文章

  1. [Linux.NET]在CentOS 7.x中编译方式安装Nginx

    Nginx是一款轻量级的Web 服务器/反向代理服务器及电子邮件(IMAP/POP3)代理服务器,并在一个BSD-like 协议下发行.由俄罗斯的程序设计师Igor Sysoev所开发,供俄罗斯大型的 ...

  2. [转]在ubuntu linux下以编译方式安装LAMP(apache mysql php)环境

    FROM : http://www.cnblogs.com/eleganthqy/archive/2010/02/28/1675217.html 最近转向到了使用ubuntu做桌面,安装好系统以来一直 ...

  3. Linux 中如何用源代码安装软件,以及如何卸载它

    https://www.linuxidc.com/Linux/2017-12/149839.htm http://www.openssh.com/ http://www.openssh.com/por ...

  4. Linux 中如何卸载已安装的软件(转载)

            Linux 中如何卸载已安装的软件. Linux软件的安装和卸载一直是困扰许多新用户的难题.在Windows中,我们可以使用软件自带的安装卸载程序或在控制面板中的“添加/删除程序”来实 ...

  5. Linux 中如何卸载已安装的软件

    Linux 中如何卸载已安装的软件. Linux软件的安装和卸载一直是困扰许多新用户的难题.在Windows中,我们可以使用软件自带的安装卸载程序或在控制面板中的“添加/删除程序”来实现.与其相类似, ...

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

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

  7. 关于centos7中使用rpm方式安装mysql5.7版本后无法使用root登录的问题

    最近在centos7中通过rpm方式安装了最新版本的mysql-server 5.7 (mysql57-community-release-el7-7.noarch.rpm) ,发现安装成功后无法使用 ...

  8. ACE-6.1.0 linux 下的编译与安装步骤

    ACE-6.1.0 linux 下的编译与安装步骤  引用至http://www.cnblogs.com/liangxiaxu/archive/2013/03/07/2948417.html 1.从  ...

  9. 如何在Linux中轻松删除源安装的软件包?

    第1步:安装Stow 在这个例子中,我们使用的是CentOS,因此我们需要扩展的EPEL库.您可以使用以下命令安装它们:yum install epel-release然后,下面这段命令:yum in ...

随机推荐

  1. atitit.js&#160;与c#&#160;java交互html5化的原理与总结.doc

    atitit.js 与c# java交互html5化的原理与总结.doc 1. 实现html5化界面的要解决的策略 1 1.1. Js交互 1 1.2. 动态參数个数 1 1.3. 事件监听 2 2. ...

  2. android中文网站

    Google Developers中国网站发布 用户评价:  / 55 差好  最后更新于 2016年12月09日 点击数:15209   我们很高兴地宣布,Google Developers 中国网 ...

  3. 26.angularJS $routeProvider

    转自:https://www.cnblogs.com/best/tag/Angular/ O'Reilly书上的伪代码 var someModule = angular.module('someMod ...

  4. 9.java 操作mongodb插入、读取、修改以及删除基础

    1 package mongodb; import java.net.UnknownHostException; import java.util.ArrayList; import java.uti ...

  5. OpenCV FileStorage类读写XML/YML文件

    本文转自:http://www.cnblogs.com/summerRQ/articles/2524560.html 在OpenCV程序中,需要保存中间结果的时候常常会使用.xml / .yml文件, ...

  6. tac---反转输出文件

    tac命令用于将文件已行为单位的反序输出,即第一行最后显示,最后一行先显示.

  7. mysql中group by和order by混用 结果不是理想结果

    在使用mysql排序的时候会想到按照降序分组来获得一组数据,而使用order by往往得到的不是理想中的结果,那么怎么才能使用group by 和order by得到理想中的数据结果呢? 例如 有一个 ...

  8. 数据持久化-存取方式总结&应用沙盒&文件管理NSFileManager

    iOS应用数据存储的常用方式:  1.XML属性列表   (plist归档)  2.NSUserDefaults (偏好设置)  3.NSKeyedArchiver  归档(加密形式)  4.SQLi ...

  9. CCF模拟题 有趣的数

    有趣的数 时间限制: 1.0s 内存限制: 256.0MB   问题描述 我们把一个数称为有趣的,当且仅当: 1. 它的数字只包含0, 1, 2, 3,且这四个数字都出现过至少一次. 2. 所有的0都 ...

  10. js---10作用域链

    <html> <head> <title>scope basic</title> </head> <body> <scri ...