Latest news from 5wire Networks

How to deploy a webserver on AlmaLinux 8/9

his guide will walk you through deploying a web server on a fresh installation of AlmaLinux 8 or 9. We’ll cover two popular options: Apache and Nginx. Choose the one that best suits your needs.

Before you begin

  • Ensure you have a fresh AlmaLinux installation with internet access.
  • Establish a secure connection to your server (SSH).

System Update

It’s crucial to keep your system updated with the latest security patches and software versions. Use the following command:

sudo dnf update -y

Web Server Installation

Apache

Install Apache using the package manager:

sudo dnf install httpd -y

Nginx

For Nginx, use this command:

sudo dnf install nginx -y

Start and Enable the Service

Apache

Start the Apache service:

sudo systemctl start httpd

Enable Apache to start automatically at boot:

sudo systemctl enable httpd

Nginx

Start and enable Nginx similarly:

sudo systemctl start nginx
sudo systemctl enable nginx

Firewall Configuration

By default, both AlmaLinux 8 and 9 use firewalld. You’ll need to allow traffic through the firewall for your chosen web server:

Apache

Open ports 80 (HTTP) and 443 (HTTPS) if needed:

sudo firewall-cmd --permanent --add-port=80/tcp
sudo firewall-cmd --permanent --add-port=443/tcp
sudo firewall-cmd --reload

Nginx

Follow the same steps as Apache, replacing “80/tcp” with the port Nginx uses (default is 80).

Verification

Open a web browser on another computer and navigate to your server’s IP address. If everything is set up correctly, you should see the default web server page (Apache test page or Nginx welcome page).

Additional Considerations

  • Virtual Hosts: If you plan to host multiple websites on your server, you’ll need to configure virtual hosts. This allows a single server to serve content from different websites. Refer to the documentation for your chosen web server for details on virtual host configuration.
  • Security: It’s highly recommended to secure your web server after deployment. This includes hardening server settings, using strong passwords, and keeping software updated.

25% DISCOUNT FOR LIFE

Life time discount when you purchase your first order. Applies to Web Hosting, Reseller Hosting, and Cloud Servers.

Free Domain included on yearly Web Hosting plans.

Use code WEBOFF at the checkout!

Terms and Conditions apply. Voucher code is only valid for new customers.