NGINX酿造install命令未找到(NGINX brew install command not

2019-08-01 03:41发布

我做

$ brew install nginx

并获得:

==> 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 

我有这个在我的〜/ .bashrc文件:

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

当我运行nginx的-v或sudo nginx的-ti得到这样的:

-bash: nginx: command not found

我已没有安装nginx的正确?

Answer 1:

运行回声$ PATH,确实在/ usr / local / sbin中出现? 如果不是:尝试采购你的〜/ .bashrc文件,看看它是否出现:源的〜/ .bashrc

再次运行回声$ PATH。 它应该apear。



Answer 2:

在我的debian 6服务器的nginx安装在/usr/sbin/ 。 如果您想直接从终端访问该目录添加到PATH环境变量:

PATH=/usr/sbin/:$PATH

sbin目录通常添加到PATH为root用户,你在终端以root身份登录? 如果没有,你可以通过输入这么做su命令。



Answer 3:

我只是brewHome安装nginx的,我找到路径是/usr/local/Cellar/nginx/1.12.0/bin ,所以我只需要添加export PATH=$PATH:/usr/local/Cellar/nginx/1.12.0/bin到conf文件,并且效果很好。

FYI



文章来源: NGINX brew install command not found