Working on a client\'s server where there are two different versions of nginx installed. I think one of them was installed with the brew package manager (its an osx box) and the
All other answers are useful but they may not help you in case nginx is not on PATH so you're getting command not found when trying to run nginx:
I have nginx 1.2.1 on Debian 7 Wheezy, the nginx executable is not on PATH, so I needed to locate it first. It was already running, so using ps aux | grep nginx I have found out that it's located on /usr/sbin/nginx, therefore I needed to run /usr/sbin/nginx -t.
If you want to use a non-default configuration file (i.e. not /etc/nginx/nginx.conf), run it with the -c parameter: /usr/sbin/nginx -c .
You may also need to run it as root, otherwise nginx may not have permissions to open for example logs, so the command would fail.