Pergunta

Eu

$ brew install nginx

e receba:

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

Eu tenho isso no meu ~/.bashrc arquivo:

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

Quando eu executo nginx -v ou o sudo nginx -t eu posso conseguir isso:

-bash: nginx: command not found

eu não nginx instalado corretamente?

Foi útil?

Solução

executar echo $PATH, não /usr/local/sbin aparecer?se não:Tente de abastecimento seu ~/.bashrc arquivo e veja se ele aparece:fonte ~/.bashrc

executar echo $PATH novamente.Ele deve apear.

Outras dicas

No meu debian 6 servidor nginx é instalado em /usr/sbin/ .Se você quiser acessá-lo diretamente a partir do terminal adicionar esse diretório para a sua variável PATH:

PATH=/usr/sbin/:$PATH

O sbin diretórios são comumente adicionados ao CAMINHO para o usuário root, você está conectado no terminal como root ?Se não, você pode fazer isso digitando su de comando.

Acabei de instalar o nginx por brewHome, e acho que o caminho é /usr/local/Cellar/nginx/1.12.0/bin, então eu só adicionar export PATH=$PATH:/usr/local/Cellar/nginx/1.12.0/bin para o arquivo conf, e funciona bem.

FYI

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top