- 安装openresty
https://openresty.org/package/rhel/openresty.repo
wget https://openresty.org/package/rhel/openresty.repo
sudo mv openresty.repo /etc/yum.repos.d/openresty.repo
sudo yum check-update
yum install -y openresty
yum install -y openresty-resty
sudo yum --disablerepo="*" --enablerepo="openresty" list available
sudo subscription-manager repos --enable rhel-7-server-optional-rpms
- 启动openresty
mkdir work
cd work/
mkdir logs
mkdir conf
vim 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>")
}
}
}
}
~
~
/usr/local/openresty/nginx/sbin/nginx -c ~/work/conf/nginx.conf
- 实验
<p>hello, world</p>
- 练习