linux下安装nginx

来源:互联网 发布:语音播报新闻软件 编辑:程序博客网 时间:2024/04/29 01:24

我的linux wget命令下载不了,所以,我先在本地下完后,然后上传的,地址是

pcre:ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/

nginx:http://sysoev.ru/nginx/nginx-0.7.62.tar.gz



zenginx   最近版本升级的很快,之前弄过 最近整理一下

1.linux 下面安装

  1.下载 pcre-8.10.tar.gz  nginx-1.1.1.tar.gz

   2.安装 pcre 让nginx支持rewrite

     pcre-8.10.tar.gz  上传到/home 目录下面

    1) 解压 pcre

     tar zxvf   pcre-8.10.tar.gz 解压 pcre 后 /home 下面会有 pcre-8.10 文件夹

     2)配置pcre

     cd /home/ pcre-8.10

     ./configure   输入该命令后屏幕会生成一堆文件,不用去管它

     3)make

     在linux 中输入 make 命令后屏幕会生成一堆文件,不用去管它

     4)安装

      在linux 中输入 make install

   3.安装 nginx

     nginx-1.1.1.tar.gz  上传到/home 目录下面

     1) 解压 nginx

       tar zxvf    nginx-1.1.1.tar.gz  解压 nginx 后 /home 下面会有nginx-1.1.1 文件夹

      2 配置nginx

       cd   nginx-1.1.1


   ./configure --prefix=/usr/local/nginx --with-http_stub_status_module --with-zlib=../zlib --with-http_ssl_module --with-openssl=../openssl

这里遇到问题:


       1../configure: error: the HTTP cache module requires md5 functions
from OpenSSL library.  You can either disable the module by using
--without-http-cache option, or install the OpenSSL library into the system,
or build the OpenSSL library statically from the source with nginx by using
--with-http_ssl_module --with-openssl=<path> options.
ssl 功能需要 openssl 库 http://www.openssl.org/ => http://www.openssl.org/source/ LASTEST版本即可

tar zxvf openssl.tar.gz
cd openssl
./confbigure
make
make install

 gzip支持,需要zlib http://www.zlib.net/ 下载最新版即可

       3)make

       在linux 中输入 make 命令后屏幕会生成一堆文件,不用去管它

     4)安装

       在linux 中输入 make install

      5) 检查是否安装成功

         cd  /usr/local/nginx/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

       6)启动nginx 

          cd  /usr/local/nginx/sbin 目录下面 输入 ./nginx 启动 nginx

       7 )检查是否启动成功

          ie 浏览器中输入 http://192.168.15.132

 



             看到上面nginx 欢迎界面说明启动成功

             说明nginx 默认配置端口是80.配置文件主要是conf 文件夹中的nginx.conf  文件

             8)停止nginx

               pkill -9 nginx

 


     在根目录下,用apt-get install nginx可以直接安装成功

原创粉丝点击