Locate the nginx.conf file my nginx is actually using

前端 未结 6 1469
南方客
南方客 2021-01-29 23:57

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

6条回答
  •  鱼传尺愫
    2021-01-30 00:40

    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 -t.

    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.

提交回复
热议问题