yum install -y pcre-devel openssl-devel gcc curl
####安装OpenResty
yum install -y yum-utils
yum-config-manager --add-repo https://openresty.org/package/centos/openresty.repo
yum install -y openresty
添加环境变量
PATH=/usr/local/openresty/nginx/sbin:$PATH
export PATH
####配置测试
mkdir -p /home/nginx/logs/ /home/nginx/conf/
cd /home/nginx
编辑配置文件
vi 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>")
';
}
}
}
启动服务
nginx -p `pwd`/ -c conf/nginx.conf
重新加载配置
nginx -p `pwd`/ -s reload
以前写的,已经不知道现在还好不好使了