linux安装nginx的常见错误解决(转载)

来源:互联网 发布:淘宝达人自我简述 编辑:程序博客网 时间:2024/03/29 17:57
linux安装nginx详细教程

 

 

1 安装之前需要先安装:

   1.1 openssl

   1.1.1 下载 ,cd /home/bigdata/   wget  http://www.openssl.org/source/openssl-1.0.0a.tar.gz

       解压:   tar  -xvf  openssl-1.0.0a.tar.gz

                mv  openssl-1.0.0   openss

                cd  openss

                ./config

./config -t

make depend

make

make test

make install

 

   1.2 pcre

       1.2.1 下载 :http://sourceforge.net/projects/pcre/files/

                   mv    xxx  pcre210

                  ./configure --prefix=/home/bigdata/pcre210

                  make

                  make install

 

      1.2.2 在线安装    yum -y install pcre-devel

 

 

  1.3  zlib-devel

      1.3.1 在线安装  yum install -y zlib-devel

 

 

2 nginx 安装

 

2.1  nginx 下载

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

 

 

2.2  上传到/home/bigdata/nginx-1.7.9.tar.gz

   解压:  tar -xvf nginx-1.7.9.tar.gz

    注:不要改名称为  nginx

   改名称  mv  nginx-1.7.9  nginx179

   

2.3  安装

 

./configure --prefix=/home/bigdata/nginx --with-pcre=/home/bigdata/pcre210 --with-http_ssl_module --with-openssl=/home/bigdata/openssl

 

make

 

make  install

出现如下错误:

make[2]: Entering directory `/home/bigdata/pcre210'

make[2]: *** No rule to make target `libpcre.la'.  Stop.

make[2]: Leaving directory `/home/bigdata/pcre210'

make[1]: *** [/home/bigdata/pcre210/.libs/libpcre.a] Error 2

make[1]: Leaving directory `/home/bigdata/nginx'

make: *** [install] Error 2

 

解决方案:

mkdir -p /home/bigdata/pcre210/.libs

cp /usr/lib/libpcre.a /home/bigdata/pcre210/libpcre.a

cp /usr/lib/libpcre.a /home/bigdata/pcre210/libpcre.la

cp /usr/lib/libpcre.a /home/bigdata/pcre210/.libs/libpcre.a

cp /usr/lib/libpcre.a /home/bigdata/pcre210/.libs/libpcre.la

再次安装

make install

出现以下错误:

cp: `conf/koi-win' and `/home/bigdata/nginx/conf/koi-win' are the same file

make[1]: *** [install] Error 1

make[1]: Leaving directory `/home/bigdata/nginx'

make: *** [install] Error 2

 

解决方法:以下各需要的组件都是前面对应安装的路径。

./configure --prefix=/home/bigdata/nginx --conf-path=/home/bigdata/nginx/conf/nginx.conf --with-openssl=/home/bigdata/openssl --with-http_ssl_module --with-pcre=/home/bigdata/pcre210 

再次make和make install

 文章出处:http://blog.csdn.net/lili72

启动  nginx  服务

/home/bigdata/nginx/sbin/nginx -c /home/bigdata/nginx/conf/nginx.conf

查看是否启动成功

查看进程: ps -ef | grep nginx  

 

 

访问  该台机器的80端口 

http://192.168.52.130:80  

 

安装成功.

 

停止nginx

kill -QUIT 21510(主进程号)

 

Nginx 重启

/home/bigdata/nginx/sbin/nginx  -s  reload

 

Nginx的配置说明可以参考文章:

http://www.cnblogs.com/xiaogangqq123/archive/2011/03/02/1969006.html