2012-10-03 10 views
8

fand ichNGINX Gebräu installieren Befehl nicht

$ brew install nginx 

tun und erhalten:

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

Ich habe dies in meiner ~/.bashrc-Datei:

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

Als ich nginx laufen -v oder sudo nginx -ti erhalten Sie diese:

-bash: nginx: command not found 

habe ich nginx nicht richtig installiert?

+0

Wenn Sie 'echo $ PATH 'ausführen, wird/usr/local/sbin angezeigt? –

+0

Versuchen Sie, Ihre ~/.bashrc Datei zu finden und sehen Sie, ob sie erscheint: 'source ~/.bashrc'. –

+0

Nichts sollte erscheinen, aber Ihre '$ PATH'-Variable sollte aktualisiert werden. Probiere 'echo $ PATH' erneut =). Wenn es nicht funktionierte, liegt möglicherweise ein Problem mit Ihrer .bashrc –

Antwort

7

run echo $ PATH, erscheint/usr/local/sbin? Wenn nicht: Versuchen Sie, Ihre ~/.bashrc Datei zu finden und sehen Sie, ob sie erscheint: source ~/.bashrc

run echo $ PATH erneut. Es sollte erscheinen.

0

In meinem debian 6 Server ist nginx in /usr/sbin/ installiert. Wenn Sie es direkt von Endgerät zugreifen möchten, auf dieses Verzeichnis Ihrer PATH-Variable hinzu:

PATH=/usr/sbin/:$PATH 

Die sbin Verzeichnisse sind PATH für den Benutzer root häufig hinzugefügt werden Sie im Terminal als root angemeldet? Wenn nicht, können Sie dies tun, indem Sie den Befehl su eingeben.

+2

Wenn es von Homebrew installiert wird, wird es in '/ usr/local/sbin' sein. – mipadi

0

Ich installiere gerade Nginx von brewHome, und ich finde den Pfad ist /usr/local/Cellar/nginx/1.12.0/bin, so dass ich nur export PATH=$PATH:/usr/local/Cellar/nginx/1.12.0/bin in die Conf-Datei hinzufügen, und es funktioniert gut.

FYI