先去官网下载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. XMPP使用简单介绍--登录

    在现阶段的通信服务中,各种标准都有.因此会出现无法实现相互连通,而XMPP(Extensible Message and presence Protocol)协议的出现,实现了整个及时通信服务协议的互 ...

  2. Firefox 浏览器有用的插件

    1.Undo Closed Tabs Button或Undo Closed Tabs Button (revived) 恢复关闭的标签页 2.NetVideohunter Video Download ...

  3. Mysql数据库常规操作(建表、查询)

    一.表单操作 1-1.创建表 create table tb_name( id in primary key auto_increment);    1-2.查看表 desc table_name; ...

  4. vi命令常用操作

    一.vi的操作模式  vi提供两种操作模式:输入模式(insert mode)和指令模式(command mode).在输入模式下,用户可输入文本资料.在指令模式下,可进行删除.修改等各种编辑动作.  ...

  5. js图表插件绘制各种类型图表

    官网:http://www.bootcss.com/p/chart.js/ 中文参考手册:http://www.bootcss.com/p/chart.js/docs/ 一.生成折线图 :test.h ...

  6. ES6学习笔记(一)新的变量定义命令let和const

    1.一些历史 ES6(ECMAScript 6.0)是 JavaScript 语言的新一代标准,于2015 年 6 月正式发布,距今已经4年了,它的目标,是使得 JavaScript 语言可以用来编写 ...

  7. 【Linux下自定义Shell终端提示符】

    目录 基本转义符 字体颜色 背景颜色 移动光标 @ Linux系统终端提示符的特征由系统环境变量 PS1(Prompt String One)定义. 我们可以通过命令echo $PS1来查看当前设置, ...

  8. 破解root用户密码 -rwx权限

    破解root用户密码(本地登录) 1.光驱要放入系统光盘 2.重启os 3.修改启动菜单进入1运行级别 4.设置新密码 5.重启os linux的运行级别(默认3或5): 查看默认的运行级别 cat ...

  9. 安装Apache PHP MySQL PHPMyAdmin

    视频教程:https://www.youtube.com/watch?v=FJC2iGt_2bc,Youtube看不了的FQ吧-3- 本人参考这篇文章:http://blog.csdn.net/kno ...

  10. Androidbutton事件的五中写法总结

    button事件的五中写法: 1.匿名内部类 2.类实现View.OnClickListener接口 3.创建实例化接口对象 4.使用内部类 5.自己定义方法,配置Android:onclick属性 ...