How to Install a webserver on Linux

How to Install a webserver on Linux

Let's install a containerized web server stack on Linux! That will also deploy an intrusion prevention system with fail2ban, obtain trusted https certificates and a database server to install a WordPress blog.

We will use the free and open-source software Nginx.

Project Homepage: Documentation:

Prerequisites Linux Server running Ubuntu 20.04 LTS or newer Domain that points to the public IP of your Linux Server

How To Install and Use Docker on Ubuntu 20.04

Install Docker, and Docker-Compose You can still install Docker on a Linux Server that is not running Ubuntu, however, this may require different commands!

Install Docker

WhatsApp Image 2022-10-20 at 5.53.54 PM.jpeg

Check if Docker is installed correctly

sudo hello.jpeg

Download the latest version

docker 3.jpeg

Check if Docker-Compose is installed correctly

docker 4.jpeg

(Optional) Add your linux user to the docker group

docker 5.jpeg

Set up an Nginx Webserver

Create a new file docker-compose.ymlfile, please refer to the linuxserver/swag documentation: hub.docker.com/r/linuxserver/swag.

Example Docker-Compose File:

docker 6.jpeg

To start your webserver just execute the following command, while you're in the /opt/webserver_swag folder.

docker 7.jpeg

Add a database to the webserver

Update the Docker-Compose file

You can update your existing Docker-Compose template, if you want to add a database to your webserver. Because you often need a MySQL database, for example to deploy a WordPress Blog.

Example Docker-Compose File:

docker 9.jpeg

Download Details: Author: Muutassim Mukhtar

#webserver #linux