0

I'm running nginx/1.18.0 (Ubuntu) on my DigitalOcean droplet and I've recently found a need to serve mp4 files but discovered that the --with-http_mp4_module is not built by default. Initially I installed nginx with the package manager but needing mp4s served I decided to upgrade nginx to 1.20.0 and install/build it from source with the mp4 module flag. I followed the following tutorials aiming for no down time as I have few apps running.

  1. https://tonyteaches.tech/how-to-build-nginx-from-source/
  2. https://www.digitalocean.com/community/tutorials/how-to-upgrade-nginx-in-place-without-dropping-client-connections

I've followed all the steps and ran the ./configure --with-http_mp4 make and make install but when I run nginx -v I still see that 1.18.0 is running.

My questions are: Can I use the package manager to uninstall nginx 1.18.0 and then rerun ./configure --with-http_mp4 make make install? Will that erase all my configuration settings? I did notice that the new nginx.conf file is different from the old one.
Is there a graceful way of uninstalling the old version without corrupting the new install files?

Below are some outputs for their respective commands.

ps aux| grep nginx

root       80815  0.0  0.1  79340  3412 ?        Ss   Aug23   0:00 nginx: master process /usr/sbin/nginx -g daemon on; master_process on;
www-data   80816  0.0  0.5  79580 11108 ?        S    Aug23   0:01 nginx: worker process
mat      1158781  0.0  0.0   8160   660 pts/0    S+   00:33   0:00 grep --color=auto nginx

whereis nginx

nginx: /usr/bin/nginx /usr/sbin/nginx /usr/lib/nginx /etc/nginx /usr/local/nginx /usr/share/nginx /usr/share/man/man8/nginx.8.gz

sudo systemctl status nginx - It does seem like the new master process is working but I still can't use the Mp4 module.

● nginx.service - A high performance web server and a reverse proxy server
     Loaded: loaded (/lib/systemd/system/nginx.service; enabled; vendor preset: enabled)
     Active: active (running) since Tue 2022-08-23 16:47:54 EDT; 7h ago
       Docs: man:nginx(8)
    Process: 80787 ExecStartPre=/usr/sbin/nginx -t -q -g daemon on; master_process on; (code=exited, status=0/SUCCESS)
    Process: 80813 ExecStart=/usr/sbin/nginx -g daemon on; master_process on; (code=exited, status=0/SUCCESS)
   Main PID: 80815 (nginx)
      Tasks: 2 (limit: 2339)
     Memory: 13.2M
     CGroup: /system.slice/nginx.service
             ├─80815 nginx: master process /usr/sbin/nginx -g daemon on; master_process on;
             └─80816 nginx: worker process

I can provide more info if need be. I've been at it for solid few days and really hoping to get some help so I can move on from this.

2
  • Better to use config management tool such as ansible etc or take backup of your files (if you really care about config files only) as you can't control how package spec file been written.
    – asktyagi
    Aug 24, 2022 at 13:26
  • I've made backup of the config files but didn't know about the tool you mentioned. I'll check it out, thanks. My biggest worry is the down time.
    – CodeNode21
    Aug 24, 2022 at 16:42

1 Answer 1

0

In general package managers leave the configuration around. However, you should set up a copy of your environment and test the process there.

However, instead of building the nginx from source, I would use packages created by nginx: http://nginx.org/en/linux_packages.html. They should contain all nginx modules, and they are maintained regularly.

Only caveat with those packages is that configuration file structure is different from Ubuntu bundled packages, so some adaptation is needed.

1
  • Thanks for your input. One thing I haven't done is creating a test environment. Do you know of any good guides that could get me started? I take it that I can uninstall the old nginx with the package manager, I'll just have to tinker with the config files. At this point I'm working under the assumption that system is not pointing to the correct files even though everything is there.
    – CodeNode21
    Aug 24, 2022 at 16:45

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .