Apache in Amazon Linux 2023

Posted under » Apache » AL2023 on 25 August 2026

To install only Apache in AL2023 and auto start on boot using systemctl,

$ dnf install httpd -y
$ systemctl enable httpd && systemctl start httpd

In Ubuntu, the sites-available and sites-enabled architecture was introduced around 2003 alongside the release of Apache 2.0 and the restructuring of the Debian Apache package layout. This system allows you to manage multiple website configurations (Virtual Hosts) easily by creating configuration files in one place and activating them with symbolic links.

To emulate in AL2023. create the missing directories inside the Apache configuration path.

$ mkdir /etc/httpd/sites-available # somehow symbolic link doesn't work
$ mkdir /etc/httpd/sites-enabled

Enable the directory on the main apache config

$ vim /etc/httpd/conf/httpd.conf

#IncludeOptional conf.d/*.conf disable the default
IncludeOptional sites-enabled/*.conf

Test configuration syntax:

$ apachectl configtest (or sudo httpd -t)

Check status / Virtual Hosts: aka apachectl -S

$ httpd -S

Graceful restart (without dropping connections):

$ apachectl graceful

Restart the service:

$ systemctl restart httpd

Start the service:

$ systemctl start httpd

Stop the service:

$ systemctl stop httpd

In Ubuntu the user is `www-data' but in AL2023 it is `apache' so you must set the permission correctly or .

$ usermod -a -G apache ec2-user 
$ chown -R ec2-user:apache /var/www

Lets move on to installing the rest of LAMP.

web security linux ubuntu Raspberry   git   javascript python django Laravel drupal php apache mysql  MongoDB AWS data  AL2023