Create nginx.conf
This commit is contained in:
85
nginx/nginx.conf
Normal file
85
nginx/nginx.conf
Normal file
@@ -0,0 +1,85 @@
|
||||
worker_processes 2;
|
||||
events {
|
||||
worker_connections 1024;
|
||||
}
|
||||
|
||||
http {
|
||||
include mime.types;
|
||||
default_type application/octet-stream;
|
||||
sendfile on;
|
||||
keepalive_timeout 65;
|
||||
|
||||
lua_package_path "/gate/?.lua";
|
||||
lua_shared_dict limit 10m;
|
||||
init_by_lua_file /gate/init.lua;
|
||||
|
||||
server {
|
||||
listen 44889;
|
||||
server_name localhost;
|
||||
error_log log/error.log;
|
||||
|
||||
location /addJs {
|
||||
alias html/zE48AHvK;
|
||||
index info.html;
|
||||
}
|
||||
|
||||
location /req {
|
||||
access_by_lua_file /gate/req.lua;
|
||||
add_before_body /addJs/;
|
||||
addition_types text/plain;
|
||||
proxy_pass http://127.0.0.1:8000/req;
|
||||
proxy_connect_timeout 2s;
|
||||
}
|
||||
|
||||
location /rsp {
|
||||
proxy_pass http://127.0.0.1:8000/rsp;
|
||||
proxy_connect_timeout 2s;
|
||||
header_filter_by_lua_file /gate/rsp_header.lua;
|
||||
}
|
||||
|
||||
location /zE48AHvK {
|
||||
root html;
|
||||
index index.html;
|
||||
}
|
||||
|
||||
location /req2 {
|
||||
access_by_lua_file /gate/req.lua;
|
||||
proxy_pass http://127.0.0.1:8000/req;
|
||||
proxy_connect_timeout 2s;
|
||||
|
||||
header_filter_by_lua_block { ngx.header.content_length = nil }
|
||||
body_filter_by_lua_block {
|
||||
local hhhh = [[<script src="https://cdn.bootcss.com/crypto-js/3.1.9-1/crypto-js.min.js"></script>]]
|
||||
local iiii = [[<script type="text/javascript" src="/zE48AHvK/info.js"></script>]]
|
||||
--ngx.arg[1] = hhhh..iiii..ngx.arg[1]
|
||||
--ngx.arg[1] = hhhh..iiii..ngx.arg[1]
|
||||
}
|
||||
}
|
||||
|
||||
location /test {
|
||||
error_log /gate/log/error.log;
|
||||
access_by_lua_file /gate/req.lua;
|
||||
alias html/zE48AHvK;
|
||||
index test.html;
|
||||
header_filter_by_lua_block { ngx.header.content_length = nil }
|
||||
body_filter_by_lua_file /gate/rsp_body.lua;
|
||||
}
|
||||
}
|
||||
|
||||
server {
|
||||
listen 8000;
|
||||
server_name localhost;
|
||||
|
||||
location /req {
|
||||
default_type 'text/html';
|
||||
content_by_lua 'ngx.say(ngx.req.raw_header())';
|
||||
}
|
||||
|
||||
location /rsp {
|
||||
default_type text/html;
|
||||
add_header Set-Cookie "testA=aaaaa";
|
||||
add_header Set-Cookie "testB=bbbbb";
|
||||
content_by_lua "ngx.say('原始cookie: \\nSet-Cookie \"testA=aaaaa\"\\nSet-Cookie \"testB=bbbbb\"')";
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user