什么都不说了 直接干

一、安装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

最新文章

  1. git初体验(一)基础
  2. [学习笔记]四边形不等式优化DP
  3. 【leetcode】Remove Duplicates from Sorted Array II
  4. 查看、关闭linux自启动网络服务
  5. HDU 1598 find the most comfortable road (MST)
  6. GCC、GDB、Makefile
  7. c语言,结构体
  8. PyCharm 使用简介
  9. 未能加载文件或程序集&quot;Microsoft.Web.Infrastructure, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad的真正解决办法
  10. Note_JavaWeb_Jars
  11. MySQL 视图技术
  12. Android源代码目录组成介绍-android学习之旅(97)
  13. h5、css3基础
  14. css,html备忘录
  15. 洗礼灵魂,修炼python(26)--编程核心之“递归”
  16. Codeforces Round #516 (Div. 2, by Moscow Team Olympiad) D. Labyrinth
  17. 20155334 2016-2017-2 《Java程序设计》第五周学习总结
  18. ARM Memory Copy
  19. django 加载静态文件(图片,js,css)
  20. java的日志知识

热门文章

  1. idea配github
  2. 分布式理论 之 CAP 定理
  3. 微信小程序客服消息开发实战:实时在手机上接收小程序客服消息通知,以及在手机上回复
  4. Git让你从入门到精通,看这一篇就够了!
  5. Python学习笔记【第一篇】:认识python和基础知识
  6. shell编写小技巧整理
  7. python爬虫数据解析之xpath
  8. 【机器学习】--模型评估指标之混淆矩阵,ROC曲线和AUC面积
  9. Python爬虫入门教程 41-100 Fiddler+夜神模拟器+雷电模拟器配置手机APP爬虫部分
  10. linux下利用nohup后台运行jar文件包程序