windows子系统之openresty

1:windows子系统安装

  • 控制面板--->程序和功能--->启用或关闭Windows功能--->适用于Linux的Windows子系统

  • Microsoft Store--->搜索"ubuntu",安装即可。

2:openresty安装(官方安装文档)

  • 输入如下命令,进行编辑:(将server配置挂载至windows目录下,方便扩展)
sudo vim /usr/local/openresty/nginx/conf/nginx.conf

include /mnt/c/demo/openresty/test1/*.conf;

include /mnt/c/demo/openresty/test2/*.conf;
  • 在对应模块下(test1或者test2或者其他)编辑server conf
upstream proxy {
	server 10.*.*.*:8080;
}
	
server {
	listen 20030;
	client_max_body_size 4m;
	more_clear_headers "Server";
	more_clear_headers "X-AspNet-Version";
	more_clear_headers "X-Powered-By";
    
	location ~(favicon.ico) {
	    log_not_found off;
		  expires 99d;
		  break;
	}
    
	location / {
		root /mnt/c/demo//wwwroot;
		index Index.html;    
	}

	location ~/accesstokens/accesstokenget {
		internal;
		proxy_pass http://proxy;
	}

	location ~/(sz|wx|sh)/([-_a-zA-Z0-9/]+)/([-_a-zA-Z0-9/]+) {
		default_type application/json;
		set $monitor_module $2;
		set $monitor_action $3;
		access_by_lua_file  /mnt/c/demo/lua/checkAccess.lua;
		proxy_pass http://proxy;
	}
}
  • nginx reload
sudo /usr/local/openresty/nginx/sbin/nginx -s reload

大功告成!!!!

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值