1.首先下载ngix的源码linux版本【1.5.8版本】

http://nginx.org/en/download.html

2.下载PCRE library,是安装ngix的必备包之一

[root@localhost ngix]# wget http://downloads.sourceforge.net/project/pcre/pcre/8.34/pcre-8.34.zip?r=http%3A%2F%2Fsourceforge.net%2Fprojects%2Fpcre%2Ffiles%2Fpcre%2F&ts=1389689100&use_mirror=jaist
---------------------------------
[root@localhost pcre-8.34]# unzip pcre-8.34.zip
[root@localhost pcre-8.34]# cd pcre-8.34
[root@localhost pcre-8.34]# ./configure
.....shenglue
[root@localhost pcre-8.34]# make
[root@localhost pcre-8.34]# make install
make[]: Entering directory `/home/ngix/pcre-8.34'
make[]: Entering directory `/home/ngix/pcre-8.34'
/bin/mkdir -p '/usr/local/lib'
/bin/sh ./libtool --mode=install /usr/bin/install -c libpcre.la libpcreposix.la libpcrecpp.la '/usr/local/lib'

3.解压ngix,首先检测检测

[root@localhost nginx-1.5.]# ./configure 【--prefix=/ngix --with-pcre=/usr/local/pcre】
Configuration summary
+ using system PCRE library
+ OpenSSL library is not used
+ using builtin md5 code
+ sha1 library is not found
+ using system zlib library nginx path prefix: "/usr/local"
nginx binary file: "/usr/local/sbin/nginx"
nginx configuration prefix: "/usr/local/conf"
nginx configuration file: "/usr/local/conf/nginx.conf"
nginx pid file: "/usr/local/logs/nginx.pid"
nginx error log file: "/usr/local/logs/error.log"
nginx http access log file: "/usr/local/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"

通过后编译、安装:

[root@localhost nginx-1.5.]# make
[root@localhost nginx-1.5.]# make install

4.查看是否安装成功

[root@localhost sbin]# ./nginx -t
nginx: the configuration file /usr/local/conf/nginx.conf syntax is ok
nginx: configuration file /usr/local/conf/nginx.conf test is successful

有时会报错:

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

这样的话查看一下详细信息:

[root@localhost conf]# ldd $(which /usr/local/sbin/nginx)
linux-gate.so. => (0x0071b000)
libpthread.so. => /lib/libpthread.so. (×)
libcrypt.so. => /lib/libcrypt.so. (×)
libpcre.so. => not found
libcrypto.so. => /lib/libcrypto.so. (×)
libz.so. => /lib/libz.so. (×)
libc.so. => /lib/libc.so. (0x002d7000)
/lib/ld-linux.so. (0x006a8000)
libdl.so. => /lib/libdl.so. (0x008c3000)

链接文件导致,重新链接一下:

[root@localhost pcre]# cd /lib
[root@localhost lib]# ln -s libpcre.so.0.0. libpcre.so.
[root@localhost lib]#
[root@localhost lib]#

再次检查:

[root@localhost sbin]# ./nginx -t
nginx: the configuration file /usr/local/conf/nginx.conf syntax is ok
nginx: configuration file /usr/local/conf/nginx.conf test is successful
[root@localhost sbin]#

启动并访问浏览器http://172.20.70.251

Welcome to nginx!
If you see this page, the nginx web server is successfully installed and working. Further configuration is required. For online documentation and support please refer to nginx.org.
Commercial support is available at nginx.com. Thank you for using nginx.

【原创】Linux下的ngix服务器安装步骤的更多相关文章

  1. OpenSuSE Linux下安装Oracle10g的步骤

    OpenSuSE Linux下安装Oracle10g的步骤: --root用户 --1.vi etc/profile 添加脚本: if [ \$USER = "oracle" ]; ...

  2. 总结 Linux 下安装 PHP 扩展步骤

    总结一下 Linux 下安装 PHP 扩展步骤,这里以安装 PHP 的 redis 扩展为例. 一.拿到扩展包下载地址,下载扩展包 pecl 上搜索 redis wget http://pecl.ph ...

  3. [原创]Linux下网络性能测试Netperf工具介绍及安装

    [原创]Linux下网络性能测试Netperf工具介绍及安装 1 官方网站 http://www.netperf.org/netperf/ 2 Netperf介绍 Netperf是一种网络性能的测试工 ...

  4. Linux下安装load generator步骤及问题解决

    Linux下安装load generator步骤及问题解决 上一篇 / 下一篇  2014-08-06 18:33:00 / 个人分类:loadrunner相关 查看( 146 ) / 评论( 0 ) ...

  5. Linux 下 Memcached 缓存服务器安装配置

    Linux 下 Memcached 缓存服务器安装配置 [日期:2011-08-06] 来源:Linux社区  作者:Linux [字体:大 中 小]   [安装Memcache服务器端]我目前的平台 ...

  6. Linux下安装网络软件的步骤

    Linux下安装网络软件的步骤(给linux初学者,linux大神请绕路) 首先下载你所需要的软件带有deb后缀的文件 然后切换到该文件的目录 切换到超级用户权限或者是(sudo) 使用sudo dp ...

  7. Linux下修改主机名步骤

    Linux下修改主机名为gpdb 步骤一.运行vi /etc/sysconfig/network命令 NETWORKING=yesHOSTNAME=gpdb 步骤二.运行hostname gpdb命令 ...

  8. (原创)linux下Microsoft/cpprestsdk支持https(server)

    原创,转载请标明源地址 之前看网上一堆的资料说Microsoft/cpprestsdk不支持https或者说只支持window下的https,差点就被误导了,没办法,只好自己去翻了下源代码 先说明下l ...

  9. [原创] Linux下几种文件传输命令 sz rz sftp scp介绍

    Linux下几种文件传输命令 sz rz sftp scp介绍 1.sftp Secure Ftp 是一个基于SSH安全协议的文件传输管理工具.由于它是基于SSH的,会在传输过程中对用户的密码.数据等 ...

随机推荐

  1. windows下安装reidis

    下载windows下redis安装包 https://github.com/MSOpenTech/redis/releases 这时候另启一个cmd窗口,原来的不要关闭,不然就无法访问服务端了. 切换 ...

  2. iOS11访问相册权限变更问题

    手机升到iOS 11后  发现之前正常的图片保存功能无法正常使用  会闪退 经测试发现应该是权限没有开启的原因  但是NSPhotoLibraryUsageDescription已经写入plist   ...

  3. oracle数据库 sqlplus

  4. ZBrush 4R7中自定义笔刷

    为了便于雕刻,ZBrush®很人性化地设计了自定义笔刷.随着ZBrush软件版本不断更新,功能也在不断完善.只是在笔刷面板ZBrush软件就为用户提供了上百种之多,如果我们想要用某种笔刷,一个个找起来 ...

  5. 堆————数据流的第k个大的元素

    解题思路 一般地,堆和堆排序——解决 "贪心算法及其类似问题" 的利器. # 思路:我们可以用一个小根堆来做,并且限制堆的大小为k,初始化时把nums的每个数都push到堆中,如果 ...

  6. 获取浏览器端的cookie方法

    代码如下: function getCookie(key){ var cookies=document.cookie; if(cookies.length>0){ var start=cooki ...

  7. js在当前日期基础上,加1天 3天 7天 15天

    需求 点击保障期的天数 根据起始时间算出结束时间 代码 //点击保障期触发的方法 periodChange(val,id){ this.activeNumperiod=val this.submitD ...

  8. HDU 4725 The Shortest Path in Nya Graph [构造 + 最短路]

    HDU - 4725 The Shortest Path in Nya Graph http://acm.hdu.edu.cn/showproblem.php?pid=4725 This is a v ...

  9. js获取路径参数对象

    /** * 获取页面路径参数值 */ function getParams(key) { var result = {}; var paramStr = encodeURI(window.docume ...

  10. 新手学python-Day4-进制,数据类型,编码转换,列表

    python3中字符串的编码转换 names=b'\xe2\x82\xac20'.decode('utf-8') print(names) names='€20'.encode('utf-8') pr ...