Commande d'installation NGINX Brew introuvable
-
13-12-2019 - |
Question
Je fais
$ brew install nginx
et obtenir:
==> 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 ceci dans mon fichier ~/.bashrc :
export PATH=$PATH:/usr/local/sbin
Lorsque je lance nginx -v ou sudo nginx -t, j'obtiens ceci :
-bash: nginx: command not found
je n'ai pas installé nginx correctement ?
La solution
Run Echo $ Chemin, est-ce que / USR / local / sbin apparaît? si non: Essayez de rechercher votre fichier ~ / .BASHRC et voyez s'il apparaît: Source ~ / .BASHRC
Run echo $ Chemin à nouveau.Cela devrait apparaître.
Autres conseils
Sur mon serveur Debian 6, nginx est installé dans /usr/sbin/
.Si vous souhaitez y accéder directement depuis le terminal, ajoutez ce répertoire à votre variable PATH :
PATH=/usr/sbin/:$PATH
Le sbin
les répertoires sont généralement ajoutés à PATH pour l'utilisateur root, êtes-vous connecté au terminal en tant que root ?Sinon, vous pouvez le faire en entrant su
commande.
Je viens d'installer nginx par BrewHome et je trouve que le chemin est /usr/local/Cellar/nginx/1.12.0/bin
, donc j'ajoute juste export PATH=$PATH:/usr/local/Cellar/nginx/1.12.0/bin
au fichier de configuration, et cela fonctionne bien.
POUR VOTRE INFORMATION