Static compilation - how to deploy nginx in batches
大家讲道理
大家讲道理 2017-05-16 17:20:56
0
2
462

There are a batch of machines that need to deploy the same nginx. I want to copy the files directly after compiling once, but after copying, it prompts that a certain dependent library cannot be found.
Is there any way to compile it once and make it run on every machine?

大家讲道理
大家讲道理

光阴似箭催人老,日月如移越少年。

reply all(2)
習慣沉默

You can use ldd and lsof to find out the shared libraries that the binary file nginx depends on, then copy them to a directory in nginx (such as /png/pack/libs), and then use patchelf to modify the rpath and interpreter of the binary file nginx:

patchelf --set-rpath /png/pack/libs --force-rpath /png/nginx/1.8/sbin/nginx
patchelf --set-interpreter /png/pack/libs/ld-linux-x86-64.so.2 /png/nginx/1.8/sbin/nginx

Then package the directory/png and deploy it to each server. For details, please refer to how I compiled and packaged PHP7 for 64-bit Linux distributions.

淡淡烟草味

docker

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!