LEMP stack running successfully on AlmaLinux

How to install LEMP stack on AlmaLinux

A LEMP stack is an assortment of software that contains everything you need in order to serve a website, show dynamic content, and store or retrieve data from a database. The software is all within the LEMP acronym, namely the Linux operating system, NGINX web server, MySQL database (or MariaDB alternatively), and PHP programming language.

If you’ve installed AlmaLinux or migrated from CentOS to AlmaLinux, then you already have the first requirement done. Next, you just need to get your LEMP stack up and running. In this guide, we’ll show the step by step instructions to install a LEMP stack on AlmaLinux.

Note that it’s also possible to install a LAMP stack on AlmaLinux, which is very similar to LEMP except that it contains Apache as the web server instead of NGINX.

In this tutorial you will learn:

  • How to install all LEMP prerequisite packages on AlmaLinux
  • How to secure MariaDB database
  • How to start NGINX and MariaDB services
  • How to open HTTP and HTTPS firewall ports
LEMP stack running successfully on AlmaLinux

LEMP stack running successfully on AlmaLinux

Read more

Checking the status of NGINX on Ubuntu

How to check NGINX status on Ubuntu

After installing NGINX on Ubuntu Linux, either as a web server or reverse proxy server, you’ll need to learn the basics of administrating the service.

In this guide, we’ll show how to check the status of NGINX on Ubuntu. This will give you information about the state of the NGINX service, to help you determine if it’s running, accepting connections successfully, etc. We’ll also explain the various states of NGINX, so you know what to do with the information that’s presented.

In this tutorial you will learn:

  • How to check the status of NGINX with systemd
  • How to configure and access the NGINX status page
  • How to check NGINX configuration, restart, and reload the service
Checking the status of NGINX on Ubuntu

Checking the status of NGINX on Ubuntu

Read more

Uninstalling NGINX from Ubuntu

How to remove NGINX from Ubuntu

In this guide, we’ll be going over the step by step instructions to remove NGINX web server and reverse proxy server from Ubuntu Linux. Ubuntu offers us two options for uninstalling the software, either “remove” or “purge.” Read on to learn the difference and find out how to perform either function.

In this tutorial you will learn:

  • How to remove, purge, or reinstall NGINX web server / reverse proxy from Ubuntu

Read more

Successful installation page of NGINX on Linux

How to install Nginx on Linux

NGINX is one of the most popular web server suites deployed across the internet. It’s efficient, versatile, and works well on pretty much any Linux distribution. Whether you need a local server for testing, or want to host a website for the masses, NGINX is easy to set up. It can also be used as a reverse proxy server.

In this guide, we’ll be going through the step by step instructions to install NGINX on a variety of Linux distributions. We’ll also go over some basic usage commands, like how to start and stop the service. Keep reading to get NGINX setup on your own Linux system.

In this tutorial you will learn:

  • How to install NGINX on various Linux distros
  • How to manage the NGINX service
Successful installation page of NGINX on Linux

Successful installation page of NGINX on Linux

Read more

How to disable NGINX logging on Linux system

The default configuration of Nginx webserver logging system is to log both access and error logs for all enabled sites into /var/log/nginx/access.log and /var/log/nginx/error.log respectively. This default behaviour is set by the following directives found within /etc/nginx/nginx.conf configuration file:

access_log /var/log/nginx/access.log;
error_log /var/log/nginx/error.log;

Read more

Redirect HTTP traffic to HTTPS in NGINX

How to use Nginx to redirect all traffic from http to https

If your website is hosted with NGINX and it has SSL enabled, it’s best practice to disable HTTP completely and force all incoming traffic over to the HTTPS version of the website. This avoids having duplicate content and ensures that all of the site’s users are only browsing the secure version of your website. You should also see an SEO boost, as search engines prefer non-redundant and secured web pages.

In this guide, we’ll assume you’re already using NGINX on a Linux system and want to redirect all HTTP traffic to HTTPS. Even if a user happens to follow an http:// link, the site should send them to the correct and secured page, which happens instantly and without the user’s intervention.

There are two ways to setup this redirection in NGINX. One method allows you to configure the redirection for individual sites. The other method can redirect HTTP to HTTPS for all NGINX sites on your server, which is handy if you have multiple sites setup and want to avoid having to apply the exact same redirection to each one. We’ll cover the step by step instructions for both methods below. Let’s get started.

NOTE
Using Apache instead of NGINX? We’ve written a separate guide for how to use Apache to redirect all HTTP traffic to HTTPS.

In this tutorial you will learn:

  • How to redirect HTTP to HTTPS for individual NGINX websites
  • How to redirect HTTP to HTTPS for all NGINX websites

Read more

Restarting NGINX web server on Linux

How to restart NGINX on Linux

NGINX is popular web hosting and reverse proxy software for Linux systems. Like many other applications and services, it occasionally needs restarted. Restarting is especially common when making updates to configuration files. You’ll always need to restart or reload NGINX for the changes to take effect.

In this article, we’ll go over a couple different command line options for restarting and reloading an NGINX server. In addition, you’ll learn how to check the NGINX configuration file for mistakes before restarting NGINX. After all, you wouldn’t want to load up a configuration that contains errors.

In this tutorial you will learn:

  • How to reload NGINX (no effect on client connections)
  • How to completely restart NGINX

Read more

Running a WordPress website on Ubuntu 20.04 with Nginx

Ubuntu 20.04: WordPress with Nginx installation

WordPress is an extremely popular content management system (CMS) for websites. Its popularity and ubiquity really cannot be overstated, as it powers a staggering 35% of websites. It’s an easy way to get a website online, and it offers a lot in the way of customization.

Ubuntu 20.04 Focal Fossa and Nginx are the perfect combination to run your WordPress site. Using these utilities will give you a very powerful, efficient, and stable website. Best of all, all this software is completely free and the setup isn’t very difficult. Follow along with our steps below to see how to get your WordPress site up and running on Ubuntu 20.04 with Nginx.

If you’re more familiar with or happen to prefer Apache over Nginx, we’ve written a separate guide for Ubuntu 20.04 WordPress installation on Apache.

In this tutorial you will learn:

  • How to install and configure Nginx
  • How to install and configure MariaDB for MySQL
  • How to setup a MySQL database for WordPress
  • How to download and install WordPress
  • How to configure SSL for your WordPress site

Read more

Using cookies in PHP

How to enable sessions in PHP with cookies

Cookies are all around in our everyday life while we browse the Internet. Most people wouldn’t know much about them, if not for those “our website uses cookies to be operational” signs that are on mostly any page now since GDPR. Cookies have a long history if sometimes being good, sometimes bad. As it is usual with most aspects of the world, this technology can be used in a good or bad way.

In this tutorial we will explore cookies a bit from the server side programming perspective: we’ll create an example cookie in PHP, and store the visitor’s chosen username in it. The cookie will reside in the browser of the visitor, so on the next visit we can read it and use it to greet the visitor on the username submitted.

Our simple webpage will recognize the visitor as long as the cookie is present in the browser. We do not store any information on the server side: if the visitor first checks in from a PC, and next time from a smartphone, we will not know it is the same individual. This is one of the main point with cookies: we can only identify the given client, and only as long as the data is provided by that particular browser.

In this tutorial you will learn:

  • How to setup the test environment
  • How to write a simple example program that uses cookies
  • How to test the workings of the program
  • How to reset the environment

Read more

How to setup Nginx Reverse Proxy

How to setup Nginx Reverse Proxy

In this guide, you will learn how to setup an Nginx reverse proxy with step by step instructions. We will also explain how a reverse proxy server works and what its advantages are. In addition, we also go over various configuration options that Linux administrators commonly employ on their reverse proxy servers.

In this tutorial you will learn:

  • How does a reverse proxy work
  • What are the benefits of a reverse proxy
  • How to setup Nginx reverse proxy
  • How to pass headers
  • How to configure load balancing
  • How to test the Nginx configuration

Read more