RedHat 6.5 企业级下安装nginx

1.安装相关nginx依赖库文件

yum -y install gcc gcc-c++ autoconf automake
yum -y install zlib zlib-devel openssl openssl-devel

pcre库需要源码安装:
[下载地址]:(http://sourceforge.net/projects/pcre/files/pcre/)
下载后解压即可
安装:
源码安装三部曲:./configure、make 、make install
可以参考教程:
(http://chenzhou123520.iteye.com/blog/1817563)

2.安装

1)下载地址:
(http://nginx.org)
2)解压:
tar -xf
3)源码安装三部曲:./configure、make 、make install

3.解决问题

[root@yuanting nginx-1.12.2]# /usr/local/nginx/sbin/nginx  -s reload
/usr/local/nginx/sbin/nginx: error while loading shared libraries: libpcre.so.1: cannot open shared object file: No such 
file or directory

寻找库文件是否存在,若存在,则拷贝或者做软连接到/lib目录
目录下,redhat64位机器需要拷贝到/lib64目录下,改名都为libpcre.so.1
例如:

查找文件目录:$find / -type f -name *libpcre.so.* 
做软连接:ln -s /usr/local/lib/libpcre.so.1 /lib64/

4.验证安装是否成功:

[root@yuanting lib]# /usr/local/nginx/sbin/nginx -V
nginx version: nginx/1.12.2
built by gcc 4.4.7 20120313 (Red Hat 4.4.7-4) (GCC) 

5.解决启动问题:

$ /usr/local/nginx/sbin/nginx  -s reload
nginx: [error] open() "/usr/local/nginx/logs/nginx.pid" failed (2: No such file or directory)

解决方法:指定配置文件

$# /usr/local/nginx/sbin/nginx -c /usr/local/nginx/conf/nginx.conf

6.启动

[root@yuanting ~]# /usr/local/nginx/sbin/nginx  -s reload
[root@yuanting ~]# ps -ef| grep "nginx"
root      33503      1  0 09:17 ?        00:00:00 nginx: master process /usr/local/nginx/sbin/nginx -c /usr/local/nginx/c
onf/nginx.confnobody    33506  33503  0 09:18 ?        00:00:00 nginx: worker process                                          
root      33508  23788  0 09:18 pts/2    00:00:00 grep nginx
[root@yuanting ~]# 

RedHat 6.5 企业级下安装nginx_第1张图片

你可能感兴趣的:(linux,nginx,red,hat)