NGINX brew install command not found
Je ne
$ brew install nginx
et obtenez:
==> 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
J'ai cela dans mon ~/.bashrc fichier:
export PATH=$PATH:/usr/local/sbin
Quand je lance nginx -v ou sudo nginx -t-je obtenir ceci:
-bash: nginx: command not found
je ne l'ai pas installé nginx correctement?
- Lorsque vous exécutez
echo $PATH
, n' /usr/local/sbin apparaître? - Essayez de sourcing votre ~/.bashrc fichier et voir si il s'affiche:
source ~/.bashrc
. - Rien ne doit apparaître, mais votre
$PATH
variable doit être mis à jour. Essayezecho $PATH
encore =) . Si ça ne marchait pas, il pourrait y avoir un problème avec votre .bashrc - Cela a été ajouté à ce que j'ai reçu précédemment :/Users/macuser/usr/local/sbin:/Users/macuser/.rvm/bin:/Users/macuser/usr/local/sbin
- Je trouve ça bizarre que ça en ajoutant '/Users/macuser " pour le chemin d'accès que vous essayez d'exporter. C'est peut-être le problème, mais je ne sais pas comment vous aider =(
- Merci!! c'était la question. Alors que j'étais à essayer différentes choses que j'avais changé pour "export PATH=$PATH:$HOME/usr/local/sbin". J'ai juste eu à enlever "$HOME". Je l'ai changé en arrière, couru source ~/.bashrc. Maintenant, la Nginx commande fonctionne 🙂
- Super! Content d'avoir pu aider! =)
Vous devez vous connecter pour publier un commentaire.
exécuter echo $PATH, n' /usr/local/sbin apparaître?
si non:
Essayez de sourcing votre ~/.bashrc fichier et voir si il s'affiche: source ~/.bashrc
exécuter echo $CHEMIN nouveau. Il devrait apparaître.
Dans ma debian 6 serveur nginx est installé dans
/usr/sbin/
. Si vous souhaitez accéder directement à partir de la borne ajouter ce répertoire à la variable PATH:La
sbin
répertoires sont généralement ajoutés au CHEMIN d'accès de l'utilisateur root, vous êtes enregistré dans le terminal en tant que root ? Si non, vous pouvez le faire en entrantsu
commande./usr/local/sbin
.Je viens d'installer nginx par brewHome, et je trouve que le chemin est
/usr/local/Cellar/nginx/1.12.0/bin
, alors j'ai juste ajouterexport PATH=$PATH:/usr/local/Cellar/nginx/1.12.0/bin
pour le fichier conf, et il fonctionne bien.FYI