1) 我有一个静态网站,想要设置从bitbucket的“自动拉取”。
2) 我从bitbucket有一个webhook。
3) 我有一个bash脚本执行“git pull”操作。
当nginx捕捉到请求时,如何运行此脚本?
server {
listen 80;
server_name example.ru;
root /path/to/root;
index index.html;
access_log /path/to/logs/nginx-access.log;
error_log /path/to/logs/nginx-error.log;
location /autopull {
something to run autopull.sh;
}
location / {
auth_basic "Hello, login please";
auth_basic_user_file /path/to/htpasswd;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $host;
}
}
我尝试了lua_block和fastcgi服务,但都失败了。 lua无法运行os.execute(“/path/to/script”),也无法写日志。 fastcgi比较成功,但是没有权限,因为我的www-data用户在我的bitbucket仓库中没有ssh密钥。