sudo apt update
sudo apt install apache2
sudo systemctl start apache2
sudo systemctl stop apache2
sudo systemctl restart apache2
sudo systemctl status apache2
sudo apt update
sudo apt install apache2
$ sudo apt install apache2
sudo apt-get --purge remove apache2
sudo apt-get autoremove
sudo apt-get install apache2
sudo /etc/init.d/apache2 restart
sudo apt-get install apache2
sudo /etc/init.d/apache2 restart
sudo apt install apache2 -y
To install laravel v9 you will need apache2, php8 and composerv2 (Ubuntu 20.04/Ubuntu 18.04)
sudo apt update
sudo apt upgrade
Install and start apache2
sudo apt install apache2
sudo service apache2 start
Open: http://localhost:80
sudo service apache2 stop
Install php8
sudo add-apt-repository -y ppa:ondrej/php
sudo apt-get update
sudo apt-get install php8.0 php8.0-cli php8.0-common php8.0-xml php8.0-curl
php -v
Enable mods
sudo a2enmod php8.0
sudo a2enmod headers
sudo a2enmod rewrite
Install composerv2
cd /home/user
curl -sS https://getcomposer.org/installer -o composer-setup.php
sudo php composer-setup.php --install-dir=/usr/local/bin --filename=composer
compsoer -V
Install laravel project
composer create-project laravel/laravel example-app
php artisan key:generate --ansi
php artisan serve
Configuration file for apache2 example
cd /etc/apache2
sudo a2dissite 000-default.conf
cd /sites-available
sudo touch appName.conf
sudo nano appName.conf
Copy, paste and configurate:
---------------------------------------------------------------------------------
<VirtualHost *:80>
ServerName name.local
// If project is based on multiple env (admin/frontend)
SetEnv ACTIVE_MODULE frontend
DocumentRoot "pathDirectory/laravel/public"
<Directory "pathDirectory/laravel/public">
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Require all granted
Order allow,deny
Allow from all
</Directory>
ErrorLog /var/log/apache2/fileName.err
CustomLog /var/log/apache2/fileName combined
</VirtualHost>
---------------------------------------------------------------------------------
sudo a2ensite appName.conf
sudo service apache2 restart
or
sudo service apache2 start
# php 7.3 bisa diganti dengan versi yang kalian inginkan
sudo apt-get install -y libapache2-mod-php7.3 php7.3-cli php7.3-common php7.3-mbstring php7.3-gd php7.3-intl php7.3-xml php7.3-mysql php7.3-mcrypt php7.3-zip php7.3-dev
sudo apt-get install -y php7.3-mysql php7.3-opcache php7.3-pdo php7.3-xml php7.3-bcmath php7.3-bz2 php7.3-calendar php7.3-ctype php7.3-curl php7.3-dom php7.3-fileinfo php7.3-ftp
sudo apt-get install -y php7.3-gearman php7.3-gettext php7.3-iconv php7.3-igbinary php7.3-json php7.3-mailparse php7.3-mbstring php7.3-mcrypt php7.3-phar php7.3-posix php7.3-shmop php7.3-redis php7.3-simplexml php7.3-sockets php7.3-stomp
sudo apt-get install php7.3-sysvmsg php7.3-sysvsem php7.3-sysvshm php7.3-tokenizer php7.3-wddx php7.3-xmlreader php7.3-xmlwriter php7.3-xsl php7.3-zip