linux安装OpenResty
1、安装开发库
yum install -y pcre-devel openssl-devel gcc --skip-broken
2、安装OpenResty仓库
yum-config-manager --add-repo https://openresty.org/package/centos/openresty.repo
3、安装OpenResty
yum install -y openresty
4、安装opm工具
yum install -y openresty-opm
5、默认情况下,OpenResty安装的目录是:/usr/local/openresty
6、配置nginx的环境变量
vi /etc/profile
7、在最下面加入两行:
export NGINX_HOME=/usr/local/openresty/nginx
export PATH=${NGINX_HOME}/sbin:$PATH
8、退出ESC
保存:wq
生效
source /etc/profile
9、常见命令
# 启动nginx
nginx
# 重新加载配置
nginx -s reload
# 停止
nginx -s stop
10、修改nginx.conf文件
/usr/local/openresty/nginx/conf/nginx.conf
#user nobody;
worker_processes 1;
error_log logs/error.log;
events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
sendfile on;
keepalive_timeout 65;
server {
listen 8012;
server_name localhost;
location / {
root html;
index index.html index.htm;
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
}
}
11、启动
nginx
12、访问
http://自己的ip:8012