# 设置安装的yum源
sudo yum install yum-utils -y
sudo yum-config-manager --add-repo https://openresty.org/package/centos/openresty.repo
# 安装Openresty
sudo yum install openresty -y
# 安装命令行工具 resty
sudo yum install openresty-resty -y
# 查看Opm工具
# 命令行工具 opm 在 openresty-opm 包里,而 restydoc 工具在 openresty-doc 包里头。
# 列出所有 openresty 仓库里头的软件包:
sudo yum --disablerepo="*" --enablerepo="openresty" list available
# 创建一个helloworld项目,创建logs/用于记录文件和conf/配置文件的目录
mkdir ~/work
cd ~/work
mkdir logs/ conf/
# 创建一个简单的纯文本文件,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 '
ngx.say("<p>hello, world</p>