Documentation explains you how to setup a Ubuntu server step by step with Apache, php, mysql etc.
$ sudo apt-get update
$ sudo apt-get upgrade
$ php -v
$ sudo apt cache search php
$ sudo apt-add-repository ppa:ondrej/php
$ sudo apt-get update
$ sudo apt-get install apache2 libapache2-mod-php7.2 php7.2 php7.2-xml php7.2-gd php7.2-opcache php7.2-cli php7.2-fpm php7.2-mbstring php7.2-mysql php7.1-mcrypt php7.2-curl php7.2-xmlrpc php7.2-soap php7.2-zip
$ sudo apt-get install mysql-server
$ mysql_secure_installation
$ sudo apt-get install git curl wget zip unzip
$ curl -sS https://getcomposer.org/installer | sudo php -- --install-dir=/usr/local/bin --filename=composer
memory_limit = 256M
upload_max_filesize = 64M
cgi.fix_pathinfo=0
$ sudo nano /etc/apache2/sites-available/laravel.conf
<VirtualHost *:80>
ServerAdmin [email protected]
ServerName example.com
ServerAlias www.example.com
DocumentRoot /var/www/example.com/public_html
<Directory /var/www/example.com/public_html>
Options +FollowSymlinks
AllowOverride All
Require all granted
</Directory>
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
To edit configuration file
$ vim /path/to/file
$ sudo a2dissite 000-default.conf
$ sudo a2ensite laravel.conf
$ sudo a2enmod rewrite
$ sudo systemctl restart apache2.service
To enable or disable modules
$ sudo a2enmod example_mod // enable
$ sudo a2dismod example_mod // disable
$ sudo chmod -R 755 /path/to/project/directory