Вопрос

Я делаю

$ 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?

Это было полезно?

Решение

RUN ECHO $ PATH, работает / usr / local / sbin? если не: Попробуйте показывать файл ~ / .bashrc и посмотрите, если он появится: источник ~ / .bashrc

Запустите Echo $ Path снова.Это должно вернуться.

Другие советы

На моем сервере Debian 6 установлен nginx. /usr/sbin/ .Если вы хотите получить к нему доступ напрямую из терминала, добавьте этот каталог в переменную PATH:

PATH=/usr/sbin/:$PATH

А sbin каталоги обычно добавляются в PATH для пользователя root. Вы вошли в терминал как root?Если нет, вы можете сделать это, введя su команда.

Я просто устанавливаю nginx с помощью BrewHome и обнаруживаю, что путь /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