Bash 未找到NGINX brew安装命令

Bash 未找到NGINX brew安装命令,bash,command-line,nginx,homebrew,.bash-profile,Bash,Command Line,Nginx,Homebrew,.bash Profile,我知道 并获得: $ brew install nginx 我的~/.bashrc文件中有: ==> Downloading http://nginx.org/download/nginx-1.2.2.tar.gz Already downloaded: /Library/Caches/Homebrew/nginx-1.2.2.tar.gz ==> Patching patching file conf/nginx.conf ==> ./configure --prefix=

我知道

并获得:

$ brew install nginx
我的~/.bashrc文件中有:

==> Downloading http://nginx.org/download/nginx-1.2.2.tar.gz
Already downloaded: /Library/Caches/Homebrew/nginx-1.2.2.tar.gz
==> Patching
patching file conf/nginx.conf
==> ./configure --prefix=/usr/local/Cellar/nginx/1.2.2 --with-http_ssl_module --with-pcre         --with-ipv6 --with-cc-opt=-I/usr/local/include --with-ld-opt=-L/usr/local/lib --conf
==> make
==> make install
==> Caveats
In the interest of allowing you to run `nginx` without `sudo`, the default
port is set to localhost:8080.

If you want to host pages on your local machine to the public, you should 
change that to localhost:80, and run `sudo nginx`. You'll need to turn off
any other web servers running port 80, of course.

You can start nginx automatically on login running as your user with:
mkdir -p ~/Library/LaunchAgents
cp /usr/local/Cellar/nginx/1.2.2/homebrew.mxcl.nginx.plist ~/Library/LaunchAgents/
launchctl load -w ~/Library/LaunchAgents/homebrew.mxcl.nginx.plist

Though note that if running as your user, the launch agent will fail if you
try to use a port below 1024 (such as http's default of 80.)
Warning: /usr/local/sbin is not in your PATH
You can amend this by altering your ~/.bashrc file 
当我运行nginx-v或sudo nginx-t时,我得到以下结果:

 export PATH=$PATH:/usr/local/sbin

我没有正确安装nginx吗

在我的debian 6服务器中,nginx安装在
/usr/sbin/
中。如果要直接从终端访问,请将该目录添加到PATH变量:

-bash: nginx: command not found

sbin
目录通常添加到root用户的路径中,您是否以root用户身份登录终端?如果没有,您可以通过输入
su
命令来执行此操作。

运行echo$PATH,是否显示/usr/local/sbin? 如果没有:
尝试寻找你的~/.bashrc文件,看看它是否出现:source~/.bashrc


再次运行echo$PATH。它应该会消失

我只是通过brewHome安装了nginx,我发现路径是
/usr/local/ceral/nginx/1.12.0/bin
,所以我只是在conf文件中添加了
export path=$path:/usr/local/ceral/nginx/1.12.0/bin
,效果很好


仅供参考

当您运行
echo$PATH
时,/usr/local/sbin是否出现?请尝试查找~/.bashrc文件,并查看它是否出现:
source~/.bashrc
。不应显示任何内容,但应更新
$PATH
变量。请再次尝试
echo$PATH
)。如果它不起作用,您的.bashrc可能有问题。这是我之前收到的:/Users/macuser/usr/local/sbin:/Users/macuser/.rvm/bin:/Users/macuser/usr/local/sbi追加到您尝试导出的路径之前的“/Users/macuser”,我觉得很奇怪。也许这就是问题所在,但我不知道如何帮助您=(如果由自制软件安装,它将位于
/usr/local/sbin
)。
PATH=/usr/sbin/:$PATH