-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathdefault.conf
44 lines (38 loc) · 1012 Bytes
/
default.conf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
server {
listen 80;
root /data;
index index.html;
server_name _;
try_files $uri.html $uri $uri/ @notfound;
location ~* \.(ico|css|gif|jpe?g|png|js)(\?[0-9]+)?$ {
try_files $uri @notfound;
access_log off;
log_not_found off;
expires 7d;
break ;
}
location @notfound {
return 404;
}
access_log /dev/stdout;
location /deploy-with-basic-auth {
auth_basic "Restricted access";
auth_basic_user_file /etc/nginx/.htpasswd;
content_by_lua '
os.execute(string.format("/usr/bin/sudo /bin/generate-html.sh"))
';
}
location /deploy-with-secret {
auth_basic "Restricted access";
auth_basic_user_file /etc/nginx/.htpasswd;
content_by_lua '
ngx.req.read_body()
local args, err = ngx.req.get_post_args()
if args and not args["secret"] then
ngx.status = 400
return ngx.exit(400)
end
os.execute(string.format("/usr/bin/sudo /bin/generate-html.sh %s", args["secret"]))
';
}
}