Description

Install Apache, MySQL and PHP in your Linux distro.

Make sure that you have opened the :80 port before you begin

Debian Distros

The following steps have been tested on Ubuntu 16.04. Should work in any Debian distro

Installation

All packages are available as repos.

Install Apache 2

sudo apt install apache2

Install MySQL Server

sudo apt install mysql-server

Install PHP and extensions

sudo apt install php-pear php-fpm php-dev php-zip php-curl php-xmlrpc php-gd php-mysql php-mbstring php-xml libapache2-mod-php

Configuration

Create domain dir

sudo mkdir /var/www/domain.com
sudo mkdir /var/www/domain.com/public_html
public_html will be the folder you will upload the website files

Change public_html permissions

sudo chown -R $USER:$USER /var/www/domain.com/public_html
It is recommended to add your user in www-data group and change the permissions to www-data:www-data instead of $USER:$USER

sudo chmod -R 755 /var/www

Create new vhost

sudo cp /etc/apache2/sites-available/000-default.conf /etc/apache2/sites-available/domain.com.conf

sudo nano /etc/apache2/sites-available/domain.com.conf
Change the variables accordingly

Enable the new vhost

sudo a2ensite domain.com.conf

sudo a2dissite 000-default.conf

Reload Apache

sudo service apache2 reload