openresty安装配置,


安装openresty需要的库  apt-get install libreadline-dev libncurses5-dev libpcre3-dev libssl-dev perl make build-essential   构建 OpenResty 进入下载好的压缩包文件中用下面的命令进行解压 VERSION 为当前openresty的版本 tar -xzvf openresty-VERSION.tar.gz   然后在进入 openresty-VERSION/  目录, 然后输入以下命令配置(默认配置安装): ./configure   编译安装 下面命令进行编译 make 下面的命令安装 OpenResty到系统之中 make install 此时,我的系统中已经安装好了Openresty,因为在配置时使用了默认安装路径,所以我的 程序被安装到了: /usr/local/openresty/中,该文件夹中包含了luajit、lualib、nginx三个目录。 openresty的配置文件默认是在  /usr/local/openresty/nginx/conf

 

  运行nginx 进入目录,执行./nginx

 

没报错就运行起来了 执行nginx -V 查看nginx 版本信息       停止服务:
nginx -s reload  :修改配置后重新加载生效
nginx -s reopen  :重新打开日志文件
nginx -t -c /path/to/nginx.conf 测试nginx配置文件是否正确

关闭nginx:
nginx -s stop  :快速停止nginx
         quit  :完整有序的停止nginx

其他的停止nginx 方式:

ps -ef | grep nginx

kill -QUIT 主进程号     :从容停止Nginx
kill -TERM 主进程号     :快速停止Nginx
pkill -9 nginx          :强制停止Nginx



启动nginx:
nginx -c /path/to/nginx.conf

平滑重启nginx:
kill -HUP 主进程号

  

启动服务
通过下述方式启动Nginx。如果没有任何输出,说明启动成功,-p 指定我们的项目目录,-c 指定配置文件。

/usr/local/openresty/nginx/sbin/nginx -c /usr/local/openresty/nginx/conf/nginx.conf
/usr/local/openresty/nginx/sbin/nginx -p 'pwd' -c /usr/local/openresty/nginx/conf/nginx.conf
为openresty下的nginx建立软链(非必需)

ln -s /usr/local/openresty/nginx/sbin/nginx /usr/sbin/nginx
则可使用如下方式启动

/usr/sbin/nginx -c /usr/local/openresty/nginx/conf/nginx.conf

安装成功

1、/usr/local/openresty/site/lualib里添加 resty和cjson的引用

  

问题解决: The program 'nginx' can be found in the following packages: 
* nginx-extras 
* nginx-full 
* nginx-light 
Try: apt-get install <selected package>    开始我以为是我的nginx安装错了,然后找各种教程仔细看安装步骤,觉得没有问题啊,折腾好久不知道该怎么办,最好在网友的提示下仔细看了提示,然后按照提示继续做,即: apt-get install nginx-extras 回车 apt-get install nginx-full 回车 apt-get install nginx-light回车

相关内容

    暂无相关文章