Skip to content

Instantly share code, notes, and snippets.

@stevenmaguire
Last active October 26, 2015 22:53
Show Gist options
  • Save stevenmaguire/61d1a59f4ee20560ccc2 to your computer and use it in GitHub Desktop.
Save stevenmaguire/61d1a59f4ee20560ccc2 to your computer and use it in GitHub Desktop.
Get current nginx configuration directory from configure flags
#!/bin/bash
NGINX_CONFIG_DIRECTORY=$(2>&1 nginx -V | tr ' ' '\n' | grep -E -- '--conf-path=(.*)' | cut -d '=' -f 2 | sed -r 's/\/nginx\.conf//g')
# ALTERNATE
NGINX_CONFIG_DIRECTORY=$(nginx -V 2>&1 |tail -1|tr \ \\n|grep conf-path|tr = \\n|tail -1)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment