简介:openrestry是一个与lua脚本结合的高性能服务器
一:根据官网下载安装包
https://openresty.org/cn/linux-packages.html
二..配置环境
export PATH=/usr/local/openresty/nginx/sbin:$PATH
默认安装后的80端口会被开放,查看并杀死
netstat -lnpt | grep 80
kill -9 pid
三.简单例子:
https://openresty.org/cn/getting-started.html
具体操作
1,进入工作目录,如果没有,创建一个新的
cd /root/nginx
2.创建对应的工作目录
mkdir logs/ conf/
3.编写配置文件
nano conf/nginx.conf
worker_processes 1; error_log logs/error.log; events { worker_connections 1024; } http { server { listen 8080; location / { default_type text/html; content_by_lua_block { ngx.say("<p>hello, world</p>") } } } }
4.相关命令
启动命令 -p指定目录,现在是pwd当前目录
nginx -p `pwd`/ -c conf/nginx.conf
重新加载配置文件
nginx -p `pwd`/ -s reload
停止命令
nginx -p `pwd`/ -s stop
5.测试
curl http://localhost:8080/
四.真正启动nignx
1.进入默认的工作目录
cd /usr/local/openresty/nginx/
2.查看nginx信息,查看默认html等
nginx -V
查找html,看--prefix,然后找到对应的 --prefix/html/index.html
3修改默认的配置文件
nano conf/nginx.conf
4.启动nginx
nginx -c conf/nginx.conf
5.停止nginx
nginx -s stop
标签:openresty,配置文件,nginx,openrestry,centos7.9,pwd,html,conf,安装 From: https://www.cnblogs.com/Sigmund-Freud-01/p/18217289