多级缓存-Windows安装OpenResty

1、下载windows版本的openresty

2、解压
解压放在D:devopenresty-1.19.9.1目录下

nginx的默认配置文件注释太多,影响后续我们的编辑,这里将nginx.conf中的注释部分删除,保留有效部分。
修改`D:/dev/openresty-1.19.9.1/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       80;
        server_name  localhost;
        location / {
            root   html;
            index  index.html index.htm;
        }
        error_page   500 502 503 504  /50x.html;
        location = /50x.html {
            root   html;
        }
    }
}

 

启动和运行
OpenResty底层是基于Nginx的,所以运行方式与nginx基本一致:

cd D:devopenresty-1.19.9.1
d:
# 启动nginx
start nginx
# 检查nginx配置是否生效
nginx -t
# 重新加载配置
nginx -s reload
# 停止
nginx -s stop

 

3、验证
方式一、打开控制台执行命令:

tasklist /fi "imagename eq nginx.exe"

  杀死进程
  taskkill /pid 14700(pid进程) -f

 

方式二、登陆网址:
http://127.0.0.1:80/

 

原文地址:https://www.cnblogs.com/linjiqin/p/15429023.html