1

I'm trying to install nginx 1.13.1 from source on Ubuntu 16.04. My configure command is the following:

./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

The configure command work fine. But when I'm trying to compile it using make, it shows make[1]: Leaving directory '/root/nginx/nginx-1.13.1'and exit after some compilation messages. The binaries aren't updated.

The log of all commands: https://hastebin.com/sohuwivuto.pl

I ran the following commands:

(The configure plugin)
make
make install
Florian
  • 33
  • 4
  • Your question is near impossible to answer without an actual log of the compile and the commands you've ran. The answer below is probably correct, in the sense that you didn't run "make install" by the looks of it. Running "make" only compiles it. – Alexander K Jun 15 '17 at 01:20
  • Added it @AlexanderK – Florian Jun 15 '17 at 01:58
  • 1
    Which binaries did you check? Your --prefix is /usr/share/nginx which I doubt is in your PATH, thus if the binary you are checking is another place that explains why it's not updated. The compiled binary is in `/usr/share/nginx/sbin/nginx` – Alexander K Jun 15 '17 at 04:57
  • @AlexanderK I copied the arguments from the installation I had before, so I thought it's correct. My current binary is in `/usr/sbin/nginx`. But there's also a binary in the path you wrote and it seems to be the correct binary. What do I have to change in the configure command to install the binary into the correct path? – Florian Jun 15 '17 at 12:56
  • Added an answer for you! :) – Alexander K Jun 15 '17 at 15:50

2 Answers2

1

Have a look at my Nginx tutorial, that includes how to build it.

They key parts for you are the two make lines, particular "make install". The configure line may not be right for you.

./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
Tim
  • 30,383
  • 6
  • 47
  • 77
  • It already happen before the `make install`. I'll never execute it, because the `make` command already throws the error. – Florian Jun 15 '17 at 01:53
  • This is why you should include as much information as you can in your question. It would be difficult to help given there's no error message. It could even just be that the user building Nginx doesn't have permission to replace the current binary. – Tim Jun 15 '17 at 02:33
  • Also, be sure to stop your current running nginx before "make install" or it will fail – Federico Galli Jun 15 '17 at 08:37
  • @Tim I added all informations I could find the to question. – Florian Jun 15 '17 at 13:18
0

Shameless answer for points.

The binary is located in the wrong location due to having:

  1. The PATH set to /usr/share/nginx
  2. Not set --sbin-path=/usr/sbin/nginx

Fix your ./configure arguments as needed. If you write ./configure --help you will be presented with arguments available. If unsure about any of them, consult documentation.

Alexander K
  • 336
  • 1
  • 5