首页 技术 正文
技术 2022年11月15日
0 收藏 300 点赞 4,064 浏览 2302 个字

1、进入openresty-1.11.2.4的压缩包木木,我这里是在“/usr/local/”下;2、进入后执行【tar -xzvf openresty-1.11.2.4.tar.gz】进行解压3、解压成功后进入“openresty-1.11.2.4”文件夹下,执行【./configure】命令4、在“openresty-1.11.2.4”文件夹下,执行完【./configure】命令后,继续执行【make】命令5、在“openresty-1.11.2.4”文件夹下,执行完【make】命令后,继续执行【make install】命令6、安装成功后在“openresty-1.11.2.4”同目录会自动创建一个“openresty”目录,这样证明就安装成功了7、进入“openresty”目录,执行【nginx】命令启动服务,访问127.0.0.1,如果显示“Welcome to nginx!”证明成功了,注意:最好在修改好所有配置后再启动,不然端口可能会和当前服务器的有冲突8、服务器重启:【nginx -s reload :修改配置后重新加载生效】如果这种方式不行就用第9条的方法/usr/local/openresty/nginx/sbin/nginx -c /usr/local/openresty/nginx/conf/nginx.conf9、修改了配置文件需要用【nginx -c /usr/local/openresty/nginx/conf/nginx.conf】进行重启才生效 后续:1、如果服务器要使用“resty.http” 一定要把http.lua和http_headers.lua上传到“/usr/local/openresty/lualib/resty”目录下2、ngx的默认日志地址在“/var/log/nginx”下 安装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进入目录,执行./nginxopenresty安装配置 Ubuntu下

没报错就运行起来了执行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 nginxkill -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回车

相关推荐
python开发_常用的python模块及安装方法
adodb:我们领导推荐的数据库连接组件bsddb3:BerkeleyDB的连接组件Cheetah-1.0:我比较喜欢这个版本的cheeta…
日期:2022-11-24 点赞:878 阅读:8,985
Educational Codeforces Round 11 C. Hard Process 二分
C. Hard Process题目连接:http://www.codeforces.com/contest/660/problem/CDes…
日期:2022-11-24 点赞:807 阅读:5,501
下载Ubuntn 17.04 内核源代码
zengkefu@server1:/usr/src$ uname -aLinux server1 4.10.0-19-generic #21…
日期:2022-11-24 点赞:569 阅读:6,345
可用Active Desktop Calendar V7.86 注册码序列号
可用Active Desktop Calendar V7.86 注册码序列号Name: www.greendown.cn Code: &nb…
日期:2022-11-24 点赞:733 阅读:6,128
Android调用系统相机、自定义相机、处理大图片
Android调用系统相机和自定义相机实例本博文主要是介绍了android上使用相机进行拍照并显示的两种方式,并且由于涉及到要把拍到的照片显…
日期:2022-11-24 点赞:512 阅读:7,763
Struts的使用
一、Struts2的获取  Struts的官方网站为:http://struts.apache.org/  下载完Struts2的jar包,…
日期:2022-11-24 点赞:671 阅读:4,840