双节点安装

1 节点一

1.1 目录

/usr/local

cd /usr/local

1.2 openssl

rpm -ql openssl

/usr/share/doc/openssl-1.0.0

# ./configure --prefix=/usr/local/nginx --with-pcre=/usr/share/doc/pcre-7.8/ --with-zlib=/usr/share/doc/zlib-1.2.3 --with-openssl=/usr/share/doc/openssl-1.0.0

1.3 pcre库

# rpm -qa | grep pcre

pcre-7.8-6.el6.x86_64

[root@r7 software]# rpm -qa | grep pcre

pcre-7.8-6.el6.x86_64

[root@r7 software]#

[root@r7 software]# rpm -e pcre-7.8-6.el6.x86_64

error: Failed dependencies:

libpcre.so.0()(64bit) is needed by (installed) grep-2.6.3-3.el6.x86_64

libpcre.so.0()(64bit) is needed by (installed) less-436-10.el6.x86_64

libpcre.so.0()(64bit) is needed by (installed) httpd-tools-2.2.15-26.el6.x86_64

libpcre.so.0()(64bit) is needed by (installed) sssd-1.9.2-82.el6.x86_64

libpcre.so.0()(64bit) is needed by (installed) httpd-2.2.15-26.el6.x86_64

libpcre.so.0()(64bit) is needed by (installed) postfix-2:2.6.6-2.2.el6_1.x86_64

libpcre.so.0()(64bit) is needed by (installed) gnote-0.6.3-3.el6.x86_64

libpcrecpp.so.0()(64bit) is needed by (installed) gnote-0.6.3-3.el6.x86_64

pcre is needed by (installed) postfix-2:2.6.6-2.2.el6_1.x86_64

[root@r7 software]#

[root@r7 software]#

[root@r7 software]# rpm -e --nodeps pcre-7.8-6.el6.x86_64

[root@r7 software]# mkdir /usr/local/pcre

[root@r7 software]# rpm -ivh --prefix=/usr/local/pcre/ pcre-7.8-6.el6.x86_64.rpm

无法安装,重新只用rpm –ivh安装后使用rpm –ql 查看安装路径

[root@r7 software]# rpm -ql pcre

/lib64/libpcre.so.0

/lib64/libpcre.so.0.0.1

/usr/bin/pcregrep

/usr/bin/pcretest

/usr/lib64/libpcrecpp.so.0

/usr/lib64/libpcrecpp.so.0.0.0

/usr/lib64/libpcreposix.so.0

/usr/lib64/libpcreposix.so.0.0.0

/usr/share/doc/pcre-7.8

pcre要使用源码包,不然在安装nginx时会编译pcre,这时会报错。

1.4 zlib库

rpm -qa | grep zlib

zlib-devel-1.2.3-29.el6.x86_64

zlib-1.2.3-29.el6.x86_64

zlib也要使用源码包

1.5 nginx安装

cd /usr/local/

tar -xzvf nginx-1.2.8.tar.gz

cd nginx-1.2.8

./configure --prefix=/usr/local/nginx

需要pcre包

./configure --prefix=/usr/local/nginx --with-pcre=/usr/share/doc/pcre-7.8/

需要zlib包

./configure --prefix=/usr/local/nginx --with-pcre=/usr/share/doc/pcre-7.8/ --with-zlib=/usr/share/doc/zlib-1.2.3

需要OpenSSL

# ./configure --prefix=/usr/local/nginx --with-pcre=/usr/share/doc/pcre-7.8/ --with-zlib=/usr/share/doc/zlib-1.2.3 --with-openssl=/usr/share/doc/openssl-1.0.0

Configuration summary

+ using PCRE library: /usr/share/doc/pcre-7.8/

+ using OpenSSL library: /usr/share/doc/openssl-1.0.0

+ md5: using system crypto library

+ sha1: using system crypto library

+ using zlib library: /usr/share/doc/zlib-1.2.3

nginx path prefix: "/usr/local/nginx"

nginx binary file: "/usr/local/nginx/sbin/nginx"

nginx configuration prefix: "/usr/local/nginx/conf"

nginx configuration file: "/usr/local/nginx/conf/nginx.conf"

nginx pid file: "/usr/local/nginx/logs/nginx.pid"

nginx error log file: "/usr/local/nginx/logs/error.log"

nginx http access log file: "/usr/local/nginx/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@r7 nginx-1.2.8]# make

make -f objs/Makefile

make[1]: Entering directory `/usr/local/nginx-1.2.8'

cd /usr/share/doc/pcre-7.8/ \

&& if [ -f Makefile ]; then make distclean; fi \

&& CC="gcc" CFLAGS="-O2 -fomit-frame-pointer -pipe " \

./configure --disable-shared

/bin/sh: line 2: ./configure: No such file or directory

make[1]: *** [/usr/share/doc/pcre-7.8//Makefile] Error 127

make[1]: Leaving directory `/usr/local/nginx-1.2.8'

make: *** [build] Error 2

make 时,在编译pcre时报错。换作pcre的源码包重新编译ngnix

cd /usr/local/nginx-1.2.8

# ./configure --prefix=/usr/local/nginx --with-pcre=/usr/local/pcre-8.02 --with-zlib=/usr/share/doc/zlib-1.2.3 --with-openssl=/usr/share/doc/openssl-1.0.0

Configuration summary

+ using PCRE library: /usr/local/pcre-8.02

+ using OpenSSL library: /usr/share/doc/openssl-1.0.0

+ md5: using system crypto library

+ sha1: using system crypto library

+ using zlib library: /usr/share/doc/zlib-1.2.3

nginx path prefix: "/usr/local/nginx"

nginx binary file: "/usr/local/nginx/sbin/nginx"

nginx configuration prefix: "/usr/local/nginx/conf"

nginx configuration file: "/usr/local/nginx/conf/nginx.conf"

nginx pid file: "/usr/local/nginx/logs/nginx.pid"

nginx error log file: "/usr/local/nginx/logs/error.log"

nginx http access log file: "/usr/local/nginx/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"

make

zlib也要使用源码包

# ./configure --prefix=/usr/local/nginx --with-pcre=/usr/local/pcre-8.02 --with-zlib=/usr/local/zlib-1.2.8 --with-openssl=/usr/share/doc/openssl-1.0.0

Configuration summary

+ using PCRE library: /usr/local/pcre-8.02

+ using OpenSSL library: /usr/share/doc/openssl-1.0.0

+ md5: using system crypto library

+ sha1: using system crypto library

+ using zlib library: /usr/local/zlib-1.2.8

nginx path prefix: "/usr/local/nginx"

nginx binary file: "/usr/local/nginx/sbin/nginx"

nginx configuration prefix: "/usr/local/nginx/conf"

nginx configuration file: "/usr/local/nginx/conf/nginx.conf"

nginx pid file: "/usr/local/nginx/logs/nginx.pid"

nginx error log file: "/usr/local/nginx/logs/error.log"

nginx http access log file: "/usr/local/nginx/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"

make install

2 节点二

nginx依赖openssl、pcre、zlib的源码包。

2.1 安装包

nginx-1.2.8.tar.gz

openssl-1.0.1c.tar.gz

pcre-8.02.tar.gz

zlib-1.2.8.tar.gz

解压安装包至 /usr/local 目录

openssl如果使用rpm安装的话,需要两个都安装

# rpm -qa | grep openssl

openssl-1.0.0-27.el6.x86_64

openssl-devel-1.0.0-27.el6.x86_64

openssl-devel 安装需要的依赖包比较多,配置 yum 可简化安装

本次安装使用

2.2 安装nginx

[root@r8 local]# ls

bin etc games include lib lib64 libexec nginx-1.2.8 openssl-1.0.1c pcre-8.02 sbin share src zlib-1.2.8

[root@r8 local]#

[root@r8 local]# cd nginx-1.2.8/

[root@r8 nginx-1.2.8]# pwd

/usr/local/nginx-1.2.8

[root@r8 local]#

[root@r8 local]# mkdir nginx

[root@r8 local]# cd nginx-1.2.8/

[root@r8 nginx-1.2.8]# ./configure --prefix=/usr/local/nginx --with-pcre=/usr/local/pcre-8.02 --with-zlib=/usr/local/zlib-1.2.8 --with-openssl=/usr/share/doc/openssl-1.0.0

有一些东西没有找到,比如下面的资源,但不影响安装

checking for sys/filio.h ... not found

make

make install

需要说明的是,pcre与zlib的安装,下载相关源码并解压到/usr/local,在configre时使用—with-pcre和—with-zlib指向其解压目录即可。而openssl服务器上已经有了openssl-1.0.0-27.el6.x86_64,我以yum方式安装了openssl-devel-1.0.0-27.el6.x86_64,也可以卸载openssl进行源码安装,然后使用—with-openssl指向其安装目录即可。

3 常用操作

3.1 启动

[root@r8 sbin]# netstat -ntpl | grep 80

tcp 0 0 0.0.0.0:31713 0.0.0.0:* LISTEN 2803/gpnpd.bin

[root@r8 sbin]# pwd

/usr/local/nginx/sbin

[root@r8 sbin]# ./nginx

[root@r8 sbin]# netstat -ntpl | grep 80

tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN 27496/nginx

tcp 0 0 0.0.0.0:31713 0.0.0.0:* LISTEN 2803/gpnpd.bin

3.2 配置conf

[root@r8 nginx]# cd conf/

[root@r8 conf]# pwd

/usr/local/nginx/conf

[root@r8 conf]# ls

fastcgi.conf fastcgi_params.default mime.types nginx.conf.default uwsgi_params

fastcgi.conf.default koi-utf mime.types.default scgi_params uwsgi_params.default

fastcgi_params koi-win nginx.conf scgi_params.default win-utf

[root@r8 conf]# vi nginx.conf

#user nobody;

worker_processes 1;

3.3 重启

# 语法检查

[root@r8 sbin]# ./nginx -t

nginx: the configuration file /usr/local/nginx/conf/nginx.conf syntax is ok

nginx: configuration file /usr/local/nginx/conf/nginx.conf test is successful

# 重启

[root@r8 sbin]# ./nginx -s reload

4 常用配置

5 遇到问题

5.1 PID错误

[root@r8 sbin]# ./nginx -t

nginx: the configuration file /usr/local/nginx/conf/nginx.conf syntax is ok

nginx: configuration file /usr/local/nginx/conf/nginx.conf test is successful

[root@r8 sbin]#

[root@r8 sbin]#

[root@r8 sbin]#

[root@r8 sbin]# ./nginx -s reload

nginx: [error] invalid PID number "" in "/usr/local/nginx/logs/nginx.pid"

查看nginx.conf配置文件

[root@r8 conf]# vi nginx.conf

#user nobody;

worker_processes 1;

error_log logs/error.log;

#error_log logs/error.log notice;

#error_log logs/error.log info;

pid logs/nginx.pid;

events {

worker_connections 1024;

}

解决方法:使用nginx –c重新配置nginx.conf文件

[root@r8 sbin]# ./nginx -c /usr/local/nginx/conf/nginx.conf

[root@r8 sbin]# ./nginx -s reload

[root@r8 sbin]#

nginx安装笔记的更多相关文章

  1. [Openwrt 项目开发笔记]:PHP+Nginx安装(七)

    [Openwrt项目开发笔记]系列文章传送门:http://www.cnblogs.com/double-win/p/3888399.html 正文: 在上一节中,我们已经搭建了MySQL数据库了,因 ...

  2. Nginx 学习笔记之安装篇

    在windows下安装Nginx其实非常简单,只需如下几个步骤: 1. 在Nginx官网下载相应版本的安装程序,上面有最新版.稳定版等各种版本,正式运营的项目建议下载最新的稳定版 2.将下载后的压缩包 ...

  3. CentOS 7学习笔记(二)之Nginx安装

    说明: 1.这篇学习记录的目的是如何在CentOS 7上面安装Nginx,包括两种安装方式,yum源安装和源代码编译安装: 2.CentOS 7初学者,某些观点带有猜测之意,文中不足之处,还请批评指正 ...

  4. Nginx 安装学习笔记(1.安装和启动)

    centos7 编译安装和启动.停止https://www.cnblogs.com/xingyunblog/p/9072553.html 一.安装nginx 1.下载 wget http://ngin ...

  5. Nginx学习笔记(一)---Linux下安装Nginx

    1.Nginx介绍 (来自百度,相当之抽象,主要看后面看实例) 2.准备工作 2.1 Nginx安装 官方网站:http://nginx.org/ 2.2.Linux安装 安装工程可参考博客https ...

  6. nginx 学习笔记(1) nginx安装

    1.nginx安装 根据操作系统的不同,nginx的安装方式也不相同. 1.1 对linux系统来说,nginx.org提供了nginx安装包.http://nginx.org/en/linux_pa ...

  7. nginx安装配置_runoob_阅读笔记_20190917

    Nginx 安装配置_runoob菜鸟教程 Nginx 安装配置 Nginx("engine x")是一款是由俄罗斯的程序设计师Igor Sysoev所开发高性能的 Web和 反向 ...

  8. Linux下查看Nginx安装目录、版本号信息?

    Linux环境下,怎么确定Nginx是以那个config文件启动的? 输入命令行: ps  -ef | grep nginx 摁回车,将出现如下图片: master process 后面的就是 ngi ...

  9. LNMP环境搭建:Nginx安装、测试与域名配置

    Nginx作为一款优秀的Web Server软件同时也是一款优秀的负载均衡或前端反向代理.缓存服务软件 2.编译安装Nginx (1)安装Nginx依赖函数库pcre pcre为“perl兼容正则表达 ...

随机推荐

  1. 使用Window Live Writer写博客

    1.打开“日志账户”—>“日志选项”. 2.点击“更新账户信息”. 3.输入博客地址,用户名和密码,点击“下一步”. 4.耐心等待片刻... 5.设置“日志昵称”,点击“完成”. 这样就大功告成 ...

  2. Ultra-QuickSort 分类: POJ 排序 2015-08-03 15:39 2人阅读 评论(0) 收藏

    Ultra-QuickSort Time Limit: 7000MS   Memory Limit: 65536K Total Submissions: 48111   Accepted: 17549 ...

  3. 查找练习 hash——出现过的数字 分类: 查找 2015-06-18 17:30 7人阅读 评论(0) 收藏

    查找练习 hash--出现过的数字 *Time Limit: 1000ms Memory limit: 65536K 有疑问?点这里^_^ 题目描述 有一个数据字典,里面存有n个数字(n<=10 ...

  4. 深入理解include预编译原理

    http://ticktick.blog.51cto.com/823160/596179 你了解 #include 某个 .h 文件后,编译器做了哪些操作么? 你清楚为什么在 .h文件中定义函数实现的 ...

  5. Reflection实现通用增删改

    新增 /// <summary> /// 通用新增方法 /// </summary> /// <param name="arr">一行数据封装的 ...

  6. 2013年江西理工大学C语言程序设计竞赛(高级组)

    A 解法:dfs搜索,注意一个剪枝,否则会超时(听说原本是个dp)? #include<stdio.h> //#include<bits/stdc++.h> #include& ...

  7. 2016年11月25日 星期五 --出埃及记 Exodus 20:16

    2016年11月25日 星期五 --出埃及记 Exodus 20:16 "You shall not give false testimony against your neighbor.不 ...

  8. 窗体移动API

    //窗体移动API [DllImport("user32.dll")] public static extern bool ReleaseCapture(); [DllImport ...

  9. Linux按照CPU、内存、磁盘IO、网络性能监测

      系统优化是一项复杂.繁琐.长期的工作,优化前需要监测.采集.测试.评估,优化后也需要测试.采集.评估.监测,而且是一个长期和持续的过程,不 是说现在优化了,测试了,以后就可以一劳永逸了,也不是说书 ...

  10. CentOS6 启动流程图文解剖

    我们在使用Linux操作系统的时候,我们只需按下电源键,等待,然后输入账户和密码就可以使用Linux操作系统了.那么在按下电源到输入账号和密码之前,操作系统都做了些什么?下面就来讲述在这段时间发生的动 ...