nginx server: best OS?

Chat about Linux in general
Post Reply
User avatar
Level 3
Level 3
Posts: 197
Joined: Sat Jun 04, 2016 8:23 pm

nginx server: best OS?

Post by jameskga » Wed May 30, 2018 1:43 am

Hello, I'm installing nginx but I've never used it before. I'll be running Wordpress on it. Have you guys ever used nginx? I'm wondering what's the best operating system for nginx? I'm looking at CentOS 6 or 7, but I don't know what the differences are in terms of using nginx. There's actually not that much information out there.
19.2 Xfce
I am out there

User avatar
killer de bug
Level 14
Level 14
Posts: 5415
Joined: Tue Jul 08, 2008 1:49 pm
Location: Leuven, Belgium

Re: nginx server: best OS?

Post by killer de bug » Wed May 30, 2018 2:49 am

I guess CentOs 7 should give you a more recent version of nginx.
Other than this, both should be ok for what you want to do.
If it ain't broke, fix it until it is.

Level 1
Level 1
Posts: 1
Joined: Mon Mar 11, 2019 5:20 pm

Re: nginx server: best OS?

Post by abdrahi » Mon Mar 11, 2019 7:52 pm

You can run sudo nginx -v to check what version you’re on. As of this article, the current stable branch is 1.12.x. Luckily, upgrading is fairly easy and usually doesn’t break anything. You need to add a new repo, then NGINX can be upgraded every time you run your sudo apt upgrade command.

Running nginx -v, you’ll probably see something similar to this:

Code: Select all

sudo nginx -V
nginx version: nginx/1.10.3 (Ubuntu)
The first steps you’ll want to do is backing up your current NGINX configs. You can run these two commands to create a backup directory and copy your config files over to it:

Code: Select all

sudo mkdir /etc/nginx-backup/
sudo cp -r /etc/nginx/* /etc/nginx-backup/

Next we need to add the repository. For this, you’ll need to install software-properties-common if it’s not already installed. Run this command to make sure it is installed:
sudo apt-get install software-properties-common
Now we’ll add the NGINX repo by running these commands:
sudo add-apt-repository ppa:nginx/$nginx

You should get an output similar to this and you’ll need to press Enter to approve adding it:

This PPA contains the latest Stable Release version of the nginx web server software.

Code: Select all

The following architectures are supported; if your arch doesn't match this list then the PPA is not supporting that architecture:
* i386
* amd64
* armhf
* arm64
* ppc64el
The following releases of Ubuntu (including in-development releases) are supported in this PPA:
* Trusty (14.04)
* Xenial (16.04)
* Yakkety (16.10)
* Zesty (17.04)
* Artful (17.10 - in development!)
The following releases of Ubuntu are no longer supported, and have had their packages removed from the PPA:
* Lucid (10.04)
* Maverick (10.10)
* Natty (11.04)
* Oneiric (11.10)
* Quantal (11.10)
* Raring (13.04)
* Saucy (13.10)
* Utopic (14.10)
* Vivid (15.04)
* Wily (15.10)
More info:
Press [ENTER] to continue or ctrl-c to cancel adding it
gpg: keyring `/tmp/tmphecc_aoy/secring.gpg' created
gpg: keyring `/tmp/tmphecc_aoy/pubring.gpg' created
gpg: requesting key C300EE8C from hkp server
gpg: /tmp/tmphecc_aoy/trustdb.gpg: trustdb created
gpg: key C300EE8C: public key "Launchpad Stable" imported
gpg: no ultimately trusted keys found
gpg: Total number processed: 1
gpg: imported: 1 (RSA: 1)
Now we’ll want to update the available packages by running:

Code: Select all

sudo apt-get update
Finally, we’ll want to run a full upgrade which will include NGINX and all of its add-ons:

Code: Select all

sudo apt-get full-upgrade
You’ll be prompted to use a new config files twice, you’ll want to answer N to those for now to keep your current versions.

Now when you run sudo nginx -v you should see a new version.

Finally, you’ll want to edit your /etc/nginx/nginx.conf file and add this line just below the pid line near the top:

Code: Select all

include /etc/nginx/modules-enabled/*.conf;
Next, run sudo nginx -t to test the new config and make any changes you need in order for it to pass the test.

Then restart your nginx service.

Post Reply

Return to “Chat about Linux”