문제

그래요

$ brew install nginx

그리고 얻다:

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

내 ~/.bashrc 파일에 다음이 있습니다.

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

nginx -v 또는 sudo nginx -t를 실행하면 다음과 같은 결과가 나타납니다.

-bash: nginx: command not found

내가 nginx를 제대로 설치하지 않았나요?

도움이 되었습니까?

해결책

에코 $ PATH를 실행하고 / usr / local / sbin이 나타납니다. 그렇지 않은 경우 : ~ / .bashrc 파일 소싱을 시도하고 표시되는지 확인하십시오. 소스 ~ / .bashrc

에코 $ PATH를 다시 실행하십시오.그것은 아파트를해야합니다.

다른 팁

내 데비안 6 서버 NginX는 /usr/sbin/에 설치됩니다.터미널에서 직접 액세스하려는 경우 해당 디렉터리를 경로 변수에 추가하십시오.

PATH=/usr/sbin/:$PATH
.

sbin 디렉토리는 일반적으로 루트 사용자의 경로에 추가되며 터미널에 루트로 로그인합니까?그렇지 않은 경우 su 명령을 입력하여 수행 할 수 있습니다.

BrewHome으로 nginx를 설치했는데 경로는 다음과 같습니다. /usr/local/Cellar/nginx/1.12.0/bin, 그래서 그냥 추가하겠습니다 export PATH=$PATH:/usr/local/Cellar/nginx/1.12.0/bin conf 파일에 추가하면 잘 작동합니다.

참고로

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top