什么都不说了 直接干

一、安装Nginx

首先从Nginx的官网下载最新的稳定版本1.14.0:nginx

1.解压安装包

1.root@ubuntu:tar -zxf nginx-1.14.0.tar.gz 
2.root@ubuntu:cd nginx-1.14.0/
3.root@ubuntu:./configure
......
./configure: error: the HTTP rewrite module requires the PCRE library.
You can either disable the module by using --without-http_rewrite_module option,
or install the PCRE library into the system,
or build the PCRE library statically from the source with nginx by using --with-pcre=<path> option.

如果出现以上错误 提示HTTP的rewrite模块需要PCRE库,如果需要使用HTTP的rewrite功能,需要首先安装PCRE库

PCRE库的下载地址:https://sourceforge.net/projects/pcre/files/pcre/8.42/pcre-8.42.tar.gz/download

root@ubuntu:~$ tar -xzf pcre-8.42.tar.gz
root@ubuntu:~$ cd pcre-8.42/
root@ubuntu:~/pcre-8.42$ sudo ./configure
root@ubuntu:~/pcre-8.42$ sudo make
root@ubuntu:~/pcre-8.42$ sudo make install

PCRE安装完成之后继续Nginx的安装

root@ubuntu:~/pcre-8.42$ cd ../nginx-1.14./
root@ubuntu:~/nginx-1.14.$ sudo ./configure
......
./configure: error: the HTTP gzip module requires the zlib library.
You can either disable the module by using --without-http_gzip_module
option, or install the zlib library into the system, or build the zlib library
statically from the source with nginx by using --with-zlib=<path> option.

HTTP的gzip模块需要zlib库的支持,下载zlib库的最新版本:http://www.zlib.net/

root@ubuntu:~$ tar -xzf zlib-1.2..tar.gz
root@ubuntu:~$ cd zlib-1.2./
root@ubuntu:~/zlib-1.2.$ sudo ./configure
root@ubuntu:~/zlib-1.2.$ sudo make
root@ubuntu:~/zlib-1.2.$ sudo make install

安装完zlib库之后再次安装Nginx

root@ubuntu:~/zlib-1.2.$ cd ../nginx-1.14./
root@ubuntu:~/nginx-1.14.$ sudo ./configure
root@ubuntu:~/nginx-1.14.$ sudo make
root@ubuntu:~/nginx-1.14.$ sudo make instal

进入/usr/local/nginx/sbin 目录下 启动nginx

root@ubuntu:/usr/local/nginx/sbin$ ./nginx 

查看nginx进程  ps -ef|grep nginx

root@ubuntu:/home/ubuntu/Nginx# ps -ef |grep nginx
root : ? :: nginx: master process ./nginx
nobody : ? :: nginx: worker process
root : pts/ :: grep --color=auto nginx
root@ubuntu:/home/ubuntu/Nginx#

然后浏览器输入IP地址  默认80端口

到这里就完成了Nginx的安装

如果出现此报错

./nginx: error while loading shared libraries: libpcre.so.1: cannot open shared object file: No such file or directory

在/usr/local/nginx/sbin 目录下执行以下命令 创建目录

root@ubuntu:/usr/local/nginx/sbin$ sudo ln -s /usr/local/lib/libpcre.so. /lib

技术QQ群:216868740

ubuntu安装Nginx的更多相关文章

  1. ubuntu安装nginx踩坑

    ubuntu安装nginx 安装nginx tar -zxvf nginx-1.15.5.tar.gz -C /usr/local/src 解压 cd /usr/local/src/nginx-1.1 ...

  2. ubuntu安装nginx时提示error: the HTTP rewrite module requires the PCRE library

    ubuntu安装nginx时提示error: the HTTP rewrite module requires the PCRE library 须要安装pcre包. sudo apt-get upd ...

  3. Ubuntu安装Nginx+PHP7.0.4+MySQL5.6

    安装Nginx 1.首先添加nginx_signing.key(必须,否则出错) $ wget http://nginx.org/keys/nginx_signing.key $ sudo apt-k ...

  4. Ubuntu 安装 Nginx 实现反向代理

    安装Nginx依赖库(ubuntu平台) 最近域名通过了备案, 想着应用总不能带着端口号访问吧, 于是在网上踩了很多坑, 终于找到了一步直达的方法,起码这一次很顺利的实现了 安装gcc g++的依赖库 ...

  5. ubuntu安装nginx和设置网站https访问

    安装nginx 在控制台 输入 sudo apt-get install nginx 等待安装成功之后.可以打开浏览器.输入你的域名或者ip地址会出现"Welcome to nginx!&q ...

  6. ubuntu安装nginx pagespeed

    一.自动安装 使用最新稳定版本的ngx_pagespeed自动安装依赖项并构建最新的主线版nginx,请运行: $ sudo bash <(curl -f -L -sS https://ngxp ...

  7. ubuntu 安装nginx, 出现 Unable to locate package

    今天在初始化一台新的ubuntu 服务器时,敲上了 sudo apt-get install nginx 来安装nginx, 却发现提示:  Reading package lists... Done ...

  8. ubuntu安装nginx及其默认目录结构

    一. 安装包安装 1.1 安装Nginx $sudo apt-get install nginx Ubuntu安装之后的文件结构大致为: 所有的配置文件都在/etc/nginx下,并且每个虚拟主机已经 ...

  9. Ubuntu 安装nginx

    https://www.nginx.com/resources/admin-guide/load-balancer/ https://github.com/gplessis/dotdeb-nginx/ ...

随机推荐

  1. NumPy的基本用法

    NumPy简介:NumPy是高性能科学计算和数据分析的基础包.是pandas等其他各种工具的基础NumPy主要功能:ndarray,一个多维数组结构,高效且节省空间无需循环对数组数据进行快速运算的数学 ...

  2. wep api 运行周期

    1 程序集解析 2.HttpController类型的解析 3.HttpController 的选择 4.HttpController的创建 二,web api的承载宿主,iis selfhost.O ...

  3. 【死磕Java并发】-----Java内存模型之happens-before

    在上篇博客([死磕Java并发]-–深入分析volatile的实现原理)LZ提到过由于存在线程本地内存和主内存的原因,再加上重排序,会导致多线程环境下存在可见性的问题.那么我们正确使用同步.锁的情况下 ...

  4. 仓储repository概念

    1.为什么要用仓储?(仓储有什么用) 1.1 解耦 为了解耦领域层与数据映射层的关系. 1.2 管理增删查改 仓储模式最大的优点就是所有的数据访问首先是通过仓库的,对仓库的增删改都不会立即提交到数据库 ...

  5. Hadoop系列001-大数据概论

    本人微信公众号,欢迎扫码关注! 大数据概论 1.大数据概念 大数据(big data),指无法在一定时间范围内用常规软件工具进行捕捉.管理和处理的数据集合,是需要新处理模式才能具有更强的决策力.洞察发 ...

  6. 安卓 App 性能专项测试指标之 CPU 深度解析

    指标背景 很多场景下我们去使用App,可能会碰到手机会出现发热发烫的现象.这是因为CPU使用率过高.CPU过于繁忙,会使得整个系统无法响应用户,整体性能降低,用户体验变得相当差,也容易引起ANR等等一 ...

  7. synchronized的四种作用域以及不能被继承解析

    synchronized是java中用于同步的关键字,其典型的作用域如下所示. 1 对象锁 @Slf4j public class SynchronizedExample1 { private fin ...

  8. 10分钟详解Spring全家桶7大知识点

    Spring框架自2002年诞生以来一直备受开发者青睐,它包括SpringMVC.SpringBoot.Spring Cloud.Spring Cloud Dataflow等解决方案.有人亲切的称之为 ...

  9. 鸟哥Linux私房菜基础学习篇学习笔记3

    鸟哥Linux私房菜基础学习篇学习笔记3 第十二章 正则表达式与文件格式化处理: 正则表达式(Regular Expression) 是通过一些特殊字符的排列,用以查找.删除.替换一行或多行文字字符: ...

  10. 利用SQL Profiler 追踪数据库操作

    SQL Server 事件探查器 是一个界面,用于创建和管理跟踪并分析和重播跟踪结果. 这些事件保存在一个跟踪文件中,稍后试图诊断问题时,可以对该文件进行分析或用它来重播一系列特定的步骤. SQL S ...