Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 8 additions & 34 deletions docs/guides/web/nginx-mainline.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,19 +24,7 @@ Here’s a short rundown of the ways Nginx stands out/features it has:
* FastCGI support
* And, of course, IPv6

It’s great! So just `sudo dnf install nginx`, right? Well, not exactly. We just have to enable the right module first, to enable the "mainline" branch, so you can have the latest version of Nginx.

!!! Note

There's another branch called "stable", but it's actually a little outdated for most use cases. It will receive no new features as they are developed, and only the most urgently-needed bug fixes and security upgrades.

The developers of Nginx consider the "mainline" branch to be well-tested and stable for general use, *as it gets all new features, all security fixes, and all bug fixes.*

The only reasons to use the "stable" branch include:
* You *really* want to be sure that new features and big-fixes won't break any third-party code or custom code of your own.
* You want to stick with the Rocky Linux software repositories only.

A tutorial at the end of this guide will detail how to enable and install the "stable" branch with minimal fuss.
It’s great! So just `sudo dnf install nginx`, right? Yes, it's pretty much that, but we've included a few extra helpful tips to get you started.

## Prerequisites and Assumptions

Expand All @@ -47,52 +35,38 @@ You’ll need:
* The ability to run commands as root, either as the root user or with `sudo`.
* A text editor of your choice, whether graphical or command-line based. For this tutorial, I’m using `nano`.

## Installing the Repository & Enabling the Module
## Installing and Running Nginx

First, make sure your machine is updated:

```bash
sudo dnf update
```

Then, install the `epel-release` software repository:

```bash
sudo dnf install epel-release
```

Then enable the right module for the latest version of `nginx`. This module will always be called `nginx:manline`, so just enable it with `dnf` like so:

```bash
sudo dnf module enable nginx:mainline
```

It'll give you the usual "Are you sure you want to do that?", but this isn't 2nd Edition D&D with Gary Gygax himself, so yes. Of course you do. Hit ++y++ to confirm.

## Installing and Running Nginx

Then, install the package `nginx` from the previously added repository:
Then, install the `nginx` package:

```bash
sudo dnf install nginx
```

The terminal will ask you if you’re fine with installing the repository’s GPG key. You need that, so choose `Y` for yes.

Once the installation is done, start the `nginx` service and enable it to automatically start on reboot all in one go with:

```bash
sudo systemctl enable --now nginx
```

To verify that the lastest version of *Nginx* has been installed, run:
To verify that the latest version of *Nginx* (the latest version from the Rocky repos, anyway) has been installed, run:

```bash
nginx -v
```

From there, you could just start dropping HTML files into the `/usr/share/nginx/html/` directory to build a simple, static website. The configuration file for the default website/virtual host is called “nginx.conf” and it’s in `/etc/nginx/`. It also holds a number of other basic Nginx server configurations, so even if you choose to move the actual website config to another file, you should probably leave the rest of "nginx.conf" intact.

!!! Note
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
!!! Note
!!! note "Note"


Old versions of this guide used to detail how to install the nginx-mainline package from ELRepo. This is no longer an option, however. In most cases, the version of Nginx in Rocky's repos is more than sufficient, providing a stable base with backported security patches. Those who still want to use the nginx-mainline branch can follow [this guide from LinuxCapable](https://www.linuxcapable.com/how-to-install-nginx-mainline-on-rocky-linux/). Please note that using nginx-mainline is usually perfectly viable, but not supported.

## Configuring the Firewall

!!! Note
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
!!! Note
!!! note "Note"

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@SergeCroise As noted in another PR, I'm not going to convert the regular admonition to a custom admonition. The translators said it was not necessary when we brought this up before.

Expand Down