NGINX update/upgrade

August 4, 2017 123 views
Nginx

I just upgraded my NGINX (originally from One Click App LEMP) using this command

sudo service nginx stop
sudo apt install python-software-properties
sudo add-apt-repository ppa:nginx/stable
sudo apt update
sudo apt-get update
sudo apt-get install nginx

Am I doing it right?
Previous version was 1.10.3 and now I have 1.12.1

And also, between sudo apt update and sudo apt-get update, is it have any difference?

Thanks

1 Answer

Hi @MrWorldWideWeb

Yes, that looks correct. Just skip sudo apt update, since you're doing it with apt-get.

There's small differences between apt and apt-get. Use apt-get for the most things, since that's the lowest level - you can read more here:
https://askubuntu.com/questions/445384/what-is-the-difference-between-apt-and-apt-get

  • @MrWorldWideWeb
    Uh, sorry, I thought you were installing Nginx - not upgrading.
    To upgrade run this:

    sudo service nginx stop
    sudo apt install python-software-properties
    sudo add-apt-repository ppa:nginx/stable
    sudo apt-get update
    sudo apt-get upgrade
    

    I'm actually not sure if it will upgrade Nginx, when you changed the repository, but you can force that by running this command:

    sudo apt-get dist-upgrade
    
    • I see, previously I was also using sudo apt-get dist-upgrade but it only works to upgrading Ubuntu, maybe because I didn't add the latest Nginx from repo.

      Anyway, when upgrading Nginx, I was asked if I want to keep my old Nginx config file, but when manually checking the files, there's something different, is it okay to use my old config file or using a new one and manually reconfigure it again?

      Thanks

      • @MrWorldWideWeb

        Since you're not upgrading between two very different versions, then I would say it's okay to keep your old config.

        Otherwise I would recommend to start over with the newest config and manually copy each parameter from your old config.
        It's also good to go through your configurations once in a while, since you might want to clean up some stuff or make adjustments.

Have another answer? Share your knowledge.