Nginx 安装

本文主要记录Nginx 安装过程

  • 安装包的获取
    http://nginx.org/en/download.html
  • 安装步骤
    1、创建文件夹:mkdir -p /apps/svr/nginx
    2、解压文件:tar -zxvf  nginx-1.2.9.tar.gz 
    3、切换到源码路径:cd /apps/svr/nginx/nginx-1.2.9
  • 编译安装
    1、Nginx开启SSL模块:

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

    2、过程问题处理:

    报错:
    checking for OS
    + Linux 2.6.32-504.el6.x86_64 x86_64
    checking for C compiler ... not found
    ./configure: error: C compiler gcc is not found

    原因是缺少C编译器,安装gcc:  yum install gcc 
    报错:
    ./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.

    缺少PCRE包,安装系统版本的PRCE包:yum  install pcre-devel
    报错:
    ./configure: error: SSL modules require the OpenSSL library.
    You can either do not enable the modules, or install the OpenSSL library
    into the system, or build the OpenSSL library statically from the source
    with nginx by using --with-openssl=<path> option.
    安装penSSL库到系统中:yum  install openssl openssl-devel
  • 编译安装
    make & make install
  • 启动
    cd /usr/local/nginx/sbin;
    ./nginx
  • 测试

浏览器打开:http://ip地址/ ,显示如下,说明启动成功

Welcome to nginx!
If you see this page, the nginx web server is successfully installed and working. Further configuration is required.
For online documentation and support please refer to nginx.org.
Commercial support is available at nginx.com.
Thank you for using nginx.
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值