Knowledge Base


Almalinux Create LAMP Vhost

This article relate to this.

Install PHP 8.3 and such.

dnf update -y
dnf install -y dnf-utils
dnf install -y https://rpms.remirepo.net/enterprise/remi-release-8.rpm
dnf module reset php -y
dnf module enable php:remi-8.3 -y
dnf install -y php php-mysqlnd php-fpm

Install httpd

dnf install httpd -y
systemctl enable --now httpd

Configure Domain

mkdir /var/www/html/domainhere
chown apache.apache /var/www/html/domainhere
echo "<h1>Hello World!</h1>" | tee /var/www/html/domainhere/index.html
touch /var/log/domainhere-error.log
touch /var/log/domainhere-access.log

Configure vhost

vi /etc/httpd/conf.d/yourdomain.conf
<VirtualHost *:80>
    ServerName domainhere
    DocumentRoot /var/www/html/domainhere
    ErrorLog /var/log/domainhere-error.log
    CustomLog /var/log/domainhere-access.log combined
</VirtualHost>

Restart httpd

systemctl restart httpd

Ok done, now you already configured domain under httpd using Almalinux.

Please rate this article to help us improve our Knowledge Base.

0 0