#!/bin/sh
set -e

# generic test that only verifies that nginx is running with the given 
# libnginx-... module

cat <<EOF > "/etc/nginx/sites-enabled/default"
server {
  listen 80 default_server;

  location /generic {
    return 200;
  }
}
EOF

nginx -t
invoke-rc.d nginx restart || { journalctl -n all -xu nginx.service; exit 1; }

curl --fail -w "response_code: %{http_code}\n" http://127.0.0.1/generic
