系统:Centos6.6  64位

Nginx:  http://nginx.org/en/download.html 眼下最新版本号1.9.4 我下载1.8.0

watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQv/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70/gravity/Center" alt="">

下载模块依赖性Nginx须要依赖以下3个包

1.gzip 模块须要 zlib 库 ( 下载: http://www.zlib.net/ )

2.rewrite 模块须要 pcre 库 ( 下载: http://www.pcre.org/ )

3.ssl 功能须要 openssl 库 ( 下载: http://www.openssl.org/ )



依赖包安装顺序依次为:openssl、zlib、pcre, 然后安装Nginx包

watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQv/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70/gravity/Center" alt="">

假设没有安装c++编译环境,还得安装,通过yum install gcc-c++完毕安装

下载完毕后:

下一步。编译安装

openssl :

[root@localhost] tar zxvf openssl-fips-2.0.9.tar.gz

[root@localhost] cd openssl-fips-2.0.9

[root@localhost] ./config && make && make install

pcre:

[root@localhost] tar zxvf pcre-8.36.tar.gz

[root@localhost] cd pcre-8.36

[root@localhost]  ./configure && make && make install

zlib:

[root@localhost]tar zxvf zlib-1.2.8.tar.gz

[root@localhost] cd zlib-1.2.8

[root@localhost]  ./configure && make && make install

最后安装nginx

[root@localhost]tar zxvf nginx-1.8.0.tar.gz

[root@localhost] cd nginx-1.8.0

[root@localhost]  ./configure && make && make install

安装完毕后。可启动nginx:

启动命令:/usr/local/nginx/sbin/nginx

发现报错了:

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

经网上查询,这是linux的通病



[root@localhost nginx]# sbin/nginx

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

[root@localhost nginx]# error while loading shared libraries: libpcre.so.1: cannot open shared object file: No such file or directory

[root@localhost nginx]# whereis libpcre.so.1

libpcre.so: /lib64/libpcre.so.0 /usr/local/lib/libpcre.so /usr/local/lib/libpcre.so.1

[root@localhost nginx]# ln -s /usr/local/lib/libpcre.so.1 /lib64

[root@localhost nginx]# sbin/nginx   

                           

先找到libpcre.so.1所在位置,然后做个软链接就能够了。

查看是否已启动:

watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQv/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70/gravity/Center" alt="">

通过浏览器訪问:

看到这个就说明nginx安装并启动成功。

ps:

启动:/usr/local/nginx/sbin/nginx

停止/又一次载入:/usr/local/nginx/sbin/nginx -s stop(quit、reload)

验证配置文件是否合法:/usr/local/nginx/sbin/nginx -t

命令帮助:/usr/local/nginx/sbin/nginx -h

最新文章

  1. JS控制,返回上一页之后强行刷新一次
  2. C#使用Process调用批处理阻塞问题
  3. 基于VC的声音文件操作(三)
  4. iOS之小功能模块--彩虹动画进度条学习和自主封装改进
  5. IOS之UI--小实例项目--添加商品和商品名(纯代码终结版)
  6. iOS开发小技巧--利用苹果官方API播放视频(方法已经过时,了解一下)
  7. 警卫安排(dp好题)
  8. SQL Server 2005、SQL Server 2008版本比较
  9. ImageButton自定义按钮的按下效果的高效实现方法(非一般)
  10. maven下载,安装与eclipse中maven配置
  11. java代理的深入浅出(二)-CGLIB
  12. CentOS tengine mysql 5.7 php 5.6
  13. Md5的加密 java实现
  14. 爬起点小说day03
  15. java中static关键字的继承问题
  16. 【python3基础】相对路径,‘/’,‘./’,‘../’
  17. Linux 重定向 2>&1 , 1>&2
  18. PIL库的运用
  19. import logging报错raise notimplementederror 'emit must be implemented ' ^
  20. Spring Boot初识(4)- Spring Boot整合JWT

热门文章

  1. 紫书 例题 10-13 UVa 830(递推)
  2. C# 快捷使用自定义配置节点
  3. 赵雅智_运用Bitmap和Canvas实现图片显示,缩小,旋转,水印
  4. Android视图载入到窗体的过程分析
  5. 我持续推动Rust语言支持Windows XP系统
  6. 数据格式转换 (三)Office文档转HTML
  7. CXF实战之在Tomcat中公布Web Service(二)
  8. HDU 4349 Xiao Ming's Hope 组合数学
  9. 分享js中的 sort 另一种用法
  10. WebAssembly学习(四):AssemblyScript - 结构体系与内置函数