nginx

[root@zzx nginx-1.10.1]# yum install -y openssl openssl-devel zlib pcre           yum安装的pcre版本很低 可以编译安装高版本

yum install -y gcc gcc-c++  编译安装需要gcc

tar zxf pcre-8.39.tar.gz

cd  pcre-8.39

./configure

make

make install

tar 

[root@zzx ~]# tar zxf nginx-1.10.1.tar.gz 

指定用户和组 指定安装位置和安装模块

[root@zzx nginx-1.10.1]# ./configure --user=nginx --group=nginx --prefix=/application/nginx-1.10.1 --with-http_stub_status_module --with-http_ssl_module           

[root@zzx nginx-1.10.1]# make

[root@zzx nginx-1.10.1]# make install

 [root@nginx application]# ln -sv /application/nginx-1.10.1/ /application/nginx

检查语法发现错误 由于pcre版本太高了 打开共享库的时候找不到这个文件

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

[root@nginx application]# find / -name libpcre.so.1
/usr/local/lib/libpcre.so.1

[root@nginx application]# echo "/usr/local/lib" >> /etc/ld.so.conf    编辑文件
[root@nginx application]# ldconfig       使文件立即生效
[root@nginx application]# /application/nginx/sbin/nginx -t   再次检查语法

nginx: the configuration file /application/nginx-1.10.1/conf/nginx.conf syntax is ok
nginx: [emerg] getpwnam("nginx") failed       由于没有创建nginx这个用户
nginx: configuration file /application/nginx-1.10.1/conf/nginx.conf test failed

 

[root@nginx application]# useradd nginx -s /sbin/nologin -M
[root@nginx application]# passwd nginx

[root@nginx application]# /application/nginx/sbin/nginx -t   再次检查就成功了
nginx: the configuration file /application/nginx-1.10.1/conf/nginx.conf syntax is ok
nginx: configuration file /application/nginx-1.10.1/conf/nginx.conf test is successful

[root@nginx application]# /application/nginx/sbin/nginx    回车启动 不需要start

 

posted on 2016-08-12 16:54  寒星12345678999  阅读(205)  评论(4编辑  收藏  举报