什么都不说了 直接干

一、安装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. C语言中的位段(位域)知识

    在结构体或类中,为了节省成员的存储空间,可以定义某些由位组成的字段,这些字段可以不需要以byte为单位. 这些不同位长度的字段实际存储于一个或多个整形变量.位段成员必须声明为int, signed i ...

  2. 【IIS】解决IIS无响应假死状态,asp突然无法访问重启后可以使用是什么原因

    在IIS6下,经常出现w3wp的内存占用不能及时释放,从而导致服务器响应速度很慢. 可以做以下配置:1.在IIS中对每个网站进行单独的应用程序池配置.即互相之间不影响.2.设置应用程序池的回收时间,默 ...

  3. Windows Server 2016-OU组织单位日常操作

    技术无所谓贵贱,既然曾经做过就总该是要留下点什么,毕竟做技术这些年给我们留下太多太多的成长经历,总有人问这些已经很皮毛了为什么还要写,其实没那么多花哨理由,就是想着做或者不做这一块总是要对过往做个简单 ...

  4. 使用 certbot 申请泛域名https证书

    使用 certbot 申请泛域名https证书 Intro Certbot 是一个基于 Let's Encrypt 的自动化申请证书的工具,支持的系统和web server也很多,详见 Certbot ...

  5. Codeforces Round #539 (Div. 2) - D. Sasha and One More Name(思维)

    Problem   Codeforces Round #539 (Div. 2) - D. Sasha and One More Name Time Limit: 1000 mSec Problem ...

  6. TTL 和 DNS TTL 的区别

    TTL TTL是 Time To Live 的缩写,该字段指定IP包被路由器丢弃之前允许通过的最大网段数量.TTL是IPv4包头的一个8 bit字段.在IPv4包头中TTL是一个8 bit字段,它位于 ...

  7. CTF丨从零开始搭建WEB Docker靶场

    第十二届全国大学生信息安全竞赛即将开始,小伙伴们有报名参加的吗?大家在比赛前是否开始进行模拟演练了?今天,i春秋将与大家分享靶场搭建的相关内容,帮助大家更好的进行实操演练. 学习搭建Docker靶场之 ...

  8. Javascript高级编程学习笔记(94)—— Canvas(11) 合成

    合成 除了之前介绍的属性之外,还有两个属性会应用到整个2d上下文中; globalAlpha 用于指定所有绘制的透明度 globalComposition 用于表示后绘制的图形怎样与先绘制的图形进行结 ...

  9. SUSE12SP3-Mycat(3)Server.xml配置详解

    简介 server.xml 几乎保存了所有 mycat 需要的系统配置信息.其在代码内直接的映射类为 SystemConfig 类. user 标签 <user name="test& ...

  10. Got permission denied while trying to connect to the Docker daemon socket at

    添加新用户后执行docker命令由于没权限出现以下报错: ”Got permission denied while trying to connect to the Docker daemon soc ...