Esto lo probe en una maquina virtual con una instalacion limpia de CentOS8, tener en cuenta que se tiene activo el SElinux, asi que puedes probarlo:
Verificamos la version de CentOS
[root@sandbox ~]# cat /etc/redhat-release
CentOS Linux release 8.2.2004 (Core)
Instalando Apache 2.4
Antes que todo se tiene que configurar el hostname, el servidor tiene que tener un nombre de dominio FQDN
[root@sandbox ~]# hostname
sandbox
Ahora iniciamos la instalacion de Apache 2.4 que es la version oficial de la version
dnf -y install httpd
Para verificar la version es
[root@sandbox ~]# httpd -v
Server version: Apache/2.4.37 (centos)
Server built: Sep 15 2020 15:41:16
Ejecutar el post install
firewall-cmd --permanent --add-service={http,https}
firewall-cmd --reload
systemctl start httpd
systemctl enable httpd
systemctl status httpd
Instalando PHP 7.8
Para hacer la instalacion lo debemos de hacer con dnf el nuevo instalador de CenOS8
dnf -y install https://rpms.remirepo.net/enterprise/remi-release-8.rpm
dnf -y install dnf-utils
dnf module list php
dnf module reset php
dnf module -y install php:remi-7.4
dnf -y install git unzip
dnf -y install php php-curl php-dom
dnf -y install php-mbstring php-xml php-json
dnf -y install php-bcmath php-ctype php-mysql php-pdo
systemctl restart httpd
Luego de esto debemos de tener un aspecto similar a este mensaje
[root@sandbox ~]# php --version
PHP 7.4.12 (cli) (built: Oct 27 2020 15:01:52) ( NTS )
Copyright (c) The PHP Group
Zend Engine v3.4.0, Copyright (c) Zend Technologies
Instalando Composer
Se instala composer y no se debe de usar root
ya que dentro de su ejecucion se puede ejecutar script con nivel root, por ello es recomendable hacerlo con un usuario normal:
php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
php -r "if (hash_file('sha384', 'composer-setup.php') === 'c31c1e292ad7be5f49291169c0ac8f683499edddcfd4e42232982d0fd193004208a58ff6f353fde0012d35fdd72bc394') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;"
php composer-setup.php --install-dir=/usr/local/bin --filename=composer
php -r "unlink('composer-setup.php');"
Instalando el proyecto de LARAVEL
Clonamos el proyecto de prueba, para ello nos ubicamos en la carpeta /var/www/html
cd /var/www/html
git clone https://github.com/handblack/laravel8-test.git
Primero debemos de crear el archivo de configuracion
touch /etc/httpd/conf.d/vhost.conf
El archivo creado /etc/httpd/conf.d/vhost.conf
debe de tener el siguiente contenido:
<VirtualHost *:80>
DocumentRoot "/var/www/html/laravel8-test/public"
ServerName test.localhost
DirectoryIndex index.php
<Directory "/var/www/html/laravel8-test/public">
Options All
AllowOverride All
Order Allow,Deny
Allow from all
</Directory>
</VirtualHost>
Reiniciamos el servidor apache
systemctl restart httpd
Ahora configuramos el archivo .env
para ellos nos ubicamos en la carpeta del proyecto /var/www/html/laravel8-test/
cd /var/www/html/laravel8-test/
cp .env.example .env
composer install
php artisan key:generate
Ahora tenemos que cambiar los attributos de la carpeta storage /var/www/html/laravel8-test
chmod 777 -R storage
chown -R apache.apache
Ahora se tiene que habilitar las reglas de SElinux Content
dnf -y install -y policycoreutils-python-utils
semanage fcontext -a -t httpd_sys_rw_content_t "/var/www/html/laravel8-test/storage(/.*)?"
semanage fcontext -a -t httpd_sys_rw_content_t "/var/www/html/laravel8-test/bootstrap/cache(/.*)?"
chcon -R -t httpd_sys_rw_content_t /var/www/html/laravel8-test/storage
restorecon -Rv /var/www/html/