nginx server: best OS?

Chat about Linux in general
Forum rules
Do not post support questions here. Before you post read the forum rules. Topics in this forum are automatically closed 6 months after creation.
Locked
User avatar
jameskga
Level 4
Level 4
Posts: 220
Joined: Sat Jun 04, 2016 8:23 pm

nginx server: best OS?

Post by jameskga »

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.
Last edited by LockBot on Wed Dec 28, 2022 7:16 am, edited 1 time in total.
Reason: Topic automatically closed 6 months after creation. New replies are no longer allowed.
They say your favorite Mint edition was the one you installed when you still went to school with your friends.
I am out there
killer de bug

Re: nginx server: best OS?

Post by killer de bug »

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.
abdrahi

Re: nginx server: best OS?

Post by abdrahi »

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:
nginx=stable
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: https://launchpad.net/~nginx/+archive/ubuntu/stable
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 keyserver.ubuntu.com
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)
OK
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.
Locked

Return to “Chat about Linux”