search

Home  >  Q&A  >  body text

Static compilation - how to deploy nginx in batches

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?

大家讲道理大家讲道理2754 days ago493

reply all(2)I'll reply

  • 習慣沉默

    習慣沉默2017-05-16 17:22:56

    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.

    reply
    0
  • 淡淡烟草味

    淡淡烟草味2017-05-16 17:22:56

    docker

    reply
    0
  • Cancelreply