Pregunta

i hago

$ brew install nginx

y obtén:

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

Tengo esto en mi archivo ~ / .bashrc:

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

Cuando ejecuto nginx -v o sudo nginx, hago esto:

-bash: nginx: command not found

¿No he instalado NGINX correctamente?

¿Fue útil?

Solución

Ejecutar Echo $ Ruta, ¿aparecen / usr / local / sbin? si no: Intente obtener su archivo ~ / .bashrc y vea si aparece: Fuente ~ / .bashrc

Ejecutar eco $ ruta de nuevo.Debe apear.

Otros consejos

En mi Debian 6 Server Nginx se instala en /usr/sbin/.Si desea acceder a él directamente desde el terminal, agregue ese directorio a su variable de ruta:

PATH=/usr/sbin/:$PATH

Los directorios de generación sbin se agregan comúnmente a la ruta para el usuario root, ¿ha iniciado sesión en el terminal como root?Si no, puede hacerlo ingresando el comando su.

Acabo de instalar Nginx por Brewhome, y encuentro la ruta es /usr/local/Cellar/nginx/1.12.0/bin, por lo que solo agrego export PATH=$PATH:/usr/local/Cellar/nginx/1.12.0/bin al archivo confes, y funciona bien.

fyi

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top