Ubuntu

無法從源安裝 nginx

  • June 15, 2017

我正在嘗試nginx 1.13.1從原始碼安裝Ubuntu 16.04。我的配置命令如下:

./configure --with-cc-opt='-g -O2 -fPIE -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2' --with-ld-opt='-Wl,-Bsymbolic-functions -fPIE -pie -Wl,-z,relro -Wl,-z,now' --prefix=/usr/share/nginx --conf-path=/etc/nginx/nginx.conf --http-log-path=/var/log/nginx/access.log --error-log-path=/var/log/nginx/error.log --lock-path=/var/lock/nginx.lock --pid-path=/run/nginx.pid --http-client-body-temp-path=/var/lib/nginx/body --http-fastcgi-temp-path=/var/lib/nginx/fastcgi --http-proxy-temp-path=/var/lib/nginx/proxy --http-scgi-temp-path=/var/lib/nginx/scgi --http-uwsgi-temp-path=/var/lib/nginx/uwsgi --with-debug --with-pcre-jit --with-ipv6 --with-http_ssl_module --with-http_stub_status_module --with-http_realip_module --with-http_auth_request_module --with-http_addition_module --with-http_dav_module --with-http_geoip_module --with-http_gunzip_module --with-http_gzip_static_module --with-http_v2_module --with-http_sub_module --with-http_xslt_module --with-stream --with-stream_ssl_module --with-mail --with-mail_ssl_module --with-threads --with-http_realip_module

配置命令工作正常。但是當我嘗試使用 編譯它時make,它會在一些編譯消息後顯示make[1]: Leaving directory '/root/nginx/nginx-1.13.1'並退出。二進製文件未更新。

所有命令的日誌:https ://hastebin.com/sohuwivuto.pl

我執行了以下命令:

(The configure plugin)
make
make install

無恥回答積分。

由於以下原因,二進製文件位於錯誤的位置:

  1. PATH 設置為 /usr/share/nginx
  2. 未設置 –sbin-path=/usr/sbin/nginx

根據需要修復您的 ./configure 參數。如果您寫作./configure --help,您將看到可用的論據。如果不確定其中任何一個,請查閱文件。

看看我的Nginx 教程,其中包括如何建構它。

它們的關鍵部分是兩條製造線,特別是“製造安裝”。配置行可能不適合您。

./configure --prefix=/etc/nginx --sbin-path=/usr/sbin/nginx --conf-path=/etc/nginx/nginx.conf --error-log-path=/var/log/nginx/error.log --http-log-path=/var/log/nginx/access.log --pid-path=/var/run/nginx.pid --lock-path=/var/run/nginx.lock --http-client-body-temp-path=/var/cache/nginx/client_temp --http-proxy-temp-path=/var/cache/nginx/proxy_temp --http-fastcgi-temp-path=/var/cache/nginx/fastcgi_temp --http-uwsgi-temp-path=/var/cache/nginx/uwsgi_temp --http-scgi-temp-path=/var/cache/nginx/scgi_temp --user=nginx --group=nginx --with-http_ssl_module --with-http_realip_module --with-http_gunzip_module --with-http_gzip_static_module --with-threads --with-file-aio --with-http_v2_module --with-cc-opt='-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=native' --add-module=../ngx_cache_purge-2.3 --add-module=../headers-more-nginx-module
make && make install
make clean  (NB: optional)
service nginx start

引用自:https://serverfault.com/questions/855868