在Ubuntu 12.04中安装Openresty

人蠢就要多记,好记性不如烂笔头
参考网上栗子,一步一步安装亲测

1.下载源码
http://www.openresty.org/ 网站下载最新openresty的源码,按照网页所述步骤进行解压。

2.配置

cd到代码目录,进行./configure。我使用的是./configure --with-luajit,此时,提示出错了:


checking for PCRE library ... not found
checking for PCRE library in /usr/local/ ... not found
checking for PCRE library in /usr/include/pcre/ ... not found
checking for PCRE library in /usr/pkg/ ... not found
checking for PCRE library in /opt/local/ ... not found
 
. /configure : error: the HTTP rewrite module requires the PCRE library.

从错误信息中可用看出,需要PCRE library,搜索找到  网站:   http://www.pcre.org/ ,或可在 http://sourceforge.net/projects/pcre/  处下载其源码,解压,并到代码目录下执行配置,编译,安装: 

. /configure
make
make install

如果遇到错误描述:

ubuntu安装nginx时提示error: the HTTP rewrite module requires the PCRE library
解决方法:
需要安装pcre包。
sudo apt-get update
sudo apt-get install libpcre3 libpcre3-dev

你可能还需要安装 

     sudo apt-get install openssl libssl-dev

3.编译安装

运行make 和 make install来编译安装,一次通过了。此时,我的系统中已经安装好了Openresty,因为在配置时使用了默认安装路径,所以我的程序被安装到了/usr/local/openresty/中,该文件夹中包含了luajit、lualib、nginx三个目录。

4.运行nginx

进入/usr/local/openresty/nginx/sbin目录,执行./nginx 没报错就运行起来了


默认一般安装在/usr/local/openresty 下 加入环境变量或者软连接到/usr/bin

我是采用的软连接 ln -s /usr/local/openrsrty/nginx/sbin/nginx /usr/bin

执行nginx -V 查看nginx 版本信息


  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值