Domanda

Io faccio

$ brew install nginx
.

e ottieni:

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

Ho questo nel mio file ~ / .bashrc:

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

Quando eseguo nginx -v o sudo nginx -t ottengo questo:

-bash: nginx: command not found
.

Non ho installato Nginx correttamente?

È stato utile?

Soluzione

Esegui Echo $ Path, appare / usr / locale / sbin appaiono? altrimenti: Prova a approfondire il tuo file ~ / .bashrc e vedere se appare: Source ~ / .bashrc

Esegui di nuovo Echo $ Path.Dovrebbe valere.

Altri suggerimenti

Nel mio server Debian 6 Nginx è installato in /usr/sbin/.Se si desidera accedervi direttamente dal terminale aggiungere tale directory alla variabile del percorso:

PATH=/usr/sbin/:$PATH
.

Le directory sbin vengono comunemente aggiunte al percorso per l'utente root, hai effettuato l'accesso al terminale come radice?Se non puoi farlo inserendo il comando su.

Ho appena installato nginx da Brewhome e trovo che il percorso è /usr/local/Cellar/nginx/1.12.0/bin, quindi aggiungo solo export PATH=$PATH:/usr/local/Cellar/nginx/1.12.0/bin al file Conf, e funziona bene.

fyi

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top