Skip to content

Instantly share code, notes, and snippets.

@aterreno
Created August 12, 2013 07:20
Show Gist options
  • Star 5 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save aterreno/6208791 to your computer and use it in GitHub Desktop.
Save aterreno/6208791 to your computer and use it in GitHub Desktop.
Let's say that for some reason you want to execute an OS command via HTTP.. This nginx config does it by using LUA. http://openresty.org/ kicks ass.
worker_processes 1;
user root;
error_log logs/error.log;
events {
worker_connections 1024;
}
http {
server {
listen 8080;
location / {
set $exec "/opt/local/bin/pkgin update; /opt/local/bin/pkgin -y install electrostatic_";
set $version $arg_version;
content_by_lua "os.execute(ngx.var.exec .. ngx.var.version)";
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment