Skip to content

Ansible - Web Server Nginx / Apache / PHP / MariaDB / Linux

Notifications You must be signed in to change notification settings

s-damian/ansible-web-server-debian

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

38 Commits
 
 
 
 

Repository files navigation

Ansible - Nginx or Apache Web Server

Ansible Playbook : LEMP or LAMP Server on Debian

This Ansible script allows you to automate the configuration of a LEMP web server or a LAMP web server on Debian 11 server.

These Ansible roles will automate the deployment for you:

  • Install Nginx or Apache
  • Install MariaDB (supported versions: 10.5, 10.6, 10.7, 10.8, 10.9, 10.10)
  • Install PHP (supported versions: 8.0, 8.1, 8.2)
  • Install PhpMyAdmin
  • Create your Nginx / Apache Virtual Hosts (one per domain)
  • Create your MariaDB databases (one per domain)
  • Preparing the skeleton of your websites

Ansible Linux PHP MariaDB Nginx Apache

Author

This Ansible Ansible Playbook was made by Stephen Damian

Getting Started

Requirements:

  • Debian 11
  • SSH root access

Introduction:

This example is configured for a Debian local server.

If you want to configure there for a Debian remote server, you need to configure the ansible/hosts file.

Create your home user (if it doesn't exist yet):

adduser user_test

Update and upgrade:

sudo apt-get update && sudo apt-get upgrade

Install Ansible:

sudo apt-get install ansible

Configure web-server.yml:

You need to configure your ansible/web-server.yml file.

You must configure at least all the REQUIRED lines.

Ansible folder:

Send the ansible folder present in this package to the /etc folder of your Debian server.

Run the Ansible script:

ansible-playbook -i /etc/ansible/hosts /etc/ansible/web-server.yml

See the result:

Go further

Security

You must change the path of PhpMyAdmin, or remove PhpMyAdmin from public access.

Don't forget to secure your server with iptables, fail2ban, etc.

You can Configure SSL for your websites (with Certbot for example).

Performance

To improve performance, you can add cache to your Nginx / Apache configuration.

Send emails

To make your server able to send mails, you can use postfix.