nginx第一章 安装

nginx第一章 安装
1、下载
    下载地址: http://nginx.org/en/download.html
    下载得到文件nginx-1.0.10.tar.gz
2、安装
    第一步:解压文件
        >tar -xzvf nginx-1.0.10.tar.gz
    第二步:配置、编译、 安装        
        >cd nginx-1.0.10
        1)配置:
        >./configure
        报错./configure: error: the HTTP rewrite module requires the PCRE library.
                You can either disable the module by using --without-http_rewrite_module
                option, or install the PCRE library into the system, or build the PCRE library
                statically from the source with nginx by using --with-pcre=<path> option.
        解决方法:
            安装nginx的http url重写模块安装需要PCRE library,下载PCRE,地址 ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/
            解压、配置、编译、安装pcre:
            >tar -xzvf pcre-8.12.tar.gz
            >cd pcre-8.12
            >./configure
            >make
            >make install
                    如安装出现Permission denied,切换至root用户再安装。
            pcre安装完成
        再次配置nginx提示OpenSSL library is not used
            安装openssl,下载地址 http://www.openssl.org/source/
            > tar –zxvf openssl-1.0.0.tar.gz
            >cd openssl-1.0.0
            >./config

            >make

            >make install

            安装openssl结束。

       安装zlib,步骤同上

        >cd ../nginx-1.0.10

        > ./configure --prefix=/usr/local/nginx  --with-openssl=../openssl-1.0.0e --with-http_ssl_module

        更多的安装配置 

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

        --with-openssl=/usr/include (启用ssl) 

        --with-pcre=/usr/include/pcre/ (启用正规表达式) 

        --with-http_stub_status_module (安装可以查看nginx状态的程序) 

        --with-http_memcached_module (启用memcache缓存) 

        --with-http_rewrite_module (启用支持url重写)

        

        2)安装nginx:

        >make

        >make install

        安装完成。

    第三步:查看安装版本及测试配置文件

        将/usr/local/nginx/sbin加入到path环境变量,以root用户执行命令:

        >nginx -V

            nginx: nginx version: nginx/1.0.10

            nginx: built by gcc 3.4.3 20050227 (Red Hat 3.4.3-22.1)

            nginx: TLS SNI support enabled

            nginx: configure arguments: --prefix=/usr/local/nginx --with-openssl=../openssl-1.0.0e --with-http_ssl_module

        测试配置文件:

        >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

        启动nginx:

        >nginx

        查看/usr/local/nginx/logs/nginx.pid内容,即为nginx主进程id。

        可以用ps -ef | grep 24424(进程id)查看进程信息:

        root     24424     1  0 02:58 ?        00:00:00 nginx: master process nginx     

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值