人蠢就要多记,好记性不如烂笔头
参考网上栗子,一步一步安装亲测
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.
.
/configure
make
make
install
如果遇到错误描述:
ubuntu安装nginx时提示error: the HTTP rewrite module requires the PCRE library
解决方法:
需要安装pcre包。
sudo apt-get updatesudo 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 版本信息