Welcome! Log In Create A New Profile

Advanced

Nginx (1.16.1) ignores the -prefix path set in compilation

Posted by igor.okina 
Nginx (1.16.1) ignores the -prefix path set in compilation
December 29, 2020 06:18AM
Hi

I'm trying to install Nginx in an embedded system with a custom OS created with Yocto running on an ARMV7architecture. So far I have managed to crosscompile the source following this guide: https://programmer.help/blogs/cross-compiling-nginx-used-on-hi3536.html

The problem arises when trying to execute the nginx binary in the embedded device. Due to the way the embedded system is configured, only the content of some specific directories remains when restarting the system. That implies that the whole /usr is volatile, so Nginx can't be installed there.

The issue is that no matter what path I set in the -prefix option when configuring the compilation, nginx insist on searching the config and log files on "usr/local/nginx". I have even tried to set static paths specific to the files, but that didn't work.

The source was compiled in a Ubuntu 20.04 VM.

This is the configuration command I have used:

./configure
--prefix=/SYSTEM_DISK/nginx
--sbin-path=/SYSTEM_DISK/nginx/nginx
--conf-path=/SYSTEM_DISK/nginx/nginx.conf
--pid-path=/SYSTEM_DISK/nginx/nginx.pid
--error-log-path=/SYSTEM_DISK/nginx/logs/error.log
--http-log-path=/SYSTEM_DISK/nginx/logs/access.log
--with-http_ssl_module
--with-cc=arm-linux-gnueabihf-gcc
--with-cpp=arm-linux-gnueabihf-cpp
--with-pcre=/home/igorok/Mahaigaina/nginx_compilation/pcre-8.42
--with-openssl=/home/igorok/Mahaigaina/nginx_compilation/openssl-1_1_0i
--without-http_gzip_module
--without-http_upstream_zone_module



And these are the results I get in the embedded system:

#nginx -V
nginx version: nginx/1.16.1
built by gcc 7.4.1 20181213 [linaro-7.4-2019.02 revision 56ec6f6b99cc167ff0c2f8e1a2eed33b1edc85d4] (Linaro GCC 7.4-2019.02)
built with OpenSSL 1.1.0i 14 Aug 2018
TLS SNI support enabled
configure arguments: --with-http_ssl_module --with-cc=arm-linux-gnueabihf-gcc --with-cpp=arm-linux-gnueabihf-cpp --with-pcre=/home/igorok/Mahaigaina/nginx_compilation/pcre-8.42 --with-openssl=/home/igorok/Mahaigaina/nginx_compilation/openssl-1_1_0i --without-http_gzip_module --without-http_upstream_zone_module

#nginx
nginx: [alert] could not open error log file: open() "/usr/local/nginx/logs/error.log" failed (2: No such file or directory)
2020/12/13 09:23:46 [emerg] 1261#0: open() "/usr/local/nginx/conf/nginx.conf" failed (2: No such file or directory)
Attachments:
open | download - nginx.conf (2.6 KB)
Re: Nginx (1.16.1) ignores the -prefix path set in compilation
December 29, 2020 10:52AM
So I have managed to run nginx by compiling it with --prefix as the only path and using the "-p /SYSTEM_DISK/nginx" option in the terminal. In any case, I consider this to be a temporary solution and still would like to know how to run the compilation so that nginx detects the configuration and logs by default.
Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 88
Record Number of Users: 6 on February 13, 2018
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready