启动 nginx - 未找到命令

启动 nginx - 未找到命令

由于某种原因我无法启动 nginx。

服务器是OpenSUSE;我做了以下事情:

  1. 已安装http://nginx.org/download/nginx-1.0.5.tar.gz
  2. 提取文件夹
  3. 运行./配置
  4. 制作
  5. 进行安装

nginx 已被提取到 /usr/local/nginx/sbin ,我可以在其中看到 nginx。但是当我尝试运行任何命令时,它显示“找不到命令”。

运行 ./configure 时显示;

Configuration summary
  + using system PCRE library
  + OpenSSL library is not used
  + using system zlib library

  nginx path prefix: "/usr/local/nginx"
  nginx binary file: "/usr/local/nginx/sbin/nginx"
  nginx modules path: "/usr/local/nginx/modules"
  nginx configuration prefix: "/usr/local/nginx/conf"
  nginx configuration file: "/usr/local/nginx/conf/nginx.conf"
  nginx pid file: "/usr/local/nginx/logs/nginx.pid"
  nginx error log file: "/usr/local/nginx/logs/error.log"
  nginx http access log file: "/usr/local/nginx/logs/access.log"
  nginx http client request body temporary files: "client_body_temp"
  nginx http proxy temporary files: "proxy_temp"
  nginx http fastcgi temporary files: "fastcgi_temp"
  nginx http uwsgi temporary files: "uwsgi_temp"
  nginx http scgi temporary files: "scgi_temp"

我想这很好,尽管在日志中它说找不到一些东西,但我认为这不是必需的?

运行 make 时:

-ldl -lpthread -lcrypt -lpcre -lz \
-Wl,-E
sed -e "s|%%PREFIX%%|/usr/local/nginx|" \
    -e "s|%%PID_PATH%%|/usr/local/nginx/logs/nginx.pid|" \
    -e "s|%%CONF_PATH%%|/usr/local/nginx/conf/nginx.conf|" \
    -e "s|%%ERROR_LOG_PATH%%|/usr/local/nginx/logs/error.log|" \
    < man/nginx.8 > objs/nginx.8
make[1]: Leaving directory '/usr/local/src/nginx/nginx-1.12.2'

when running echo $PATH  it says;

    /usr/sbin/:/usr/sbin/:/sbin:/usr/sbin:/usr/local/sbin:/root/bin:/usr/local/bin:/usr/bin:/bin:/usr/games

不过,我可以在 sbin 中看到 nginx 吗?

答案1

您能否验证 nginx 可执行文件所在的路径?它看起来像两条不同的路径:

/usr/local/sbin/(路径)

/usr/local/nginx/sbin/(nginx 可执行文件)

仅仅因为它们都具有/usr/local/并且/sbin/并不使它们相同,/usr/local/sbin/则与 不同/usr/local/nginx/。根据您提供的路径,/usr/local/sbin/正在检查,但没有/usr/local/nginx/sbin。您希望/需要移动可执行文件,或添加/usr/local/nginx/sbin到您的路径中。

相关内容