Complete Guide to Red Hat Enterprise Linux 9
with Grant McWilliams
Apache Cheat Sheet
Item Command
Install Apache and supporting packages yum groupinstall “Web Server”
Install MariaDB database server and client tools yum install mariadb-server mariadb
systemctl start systemctl enable
Start Apache service and enable on boot
httpd httpd
systemctl start systemctl enable
Start MariaDB service and enable on boot
mariadb mariadb
Main Apache config file /etc/httpd/conf/httpd.conf
Apache module and virtual host config files /etc/httpd/conf.d/
Remove initial welcome page vi /etc/httpd/conf.d/welcome.conf
Test Apache config syntax httpd -t
Test Apache virtual host config syntax httpd -D DUMP_VHOSTS
Default web document root /var/www/html/
Apache error and access logs /var/log/httpd/
Manage Apache process apachectl
Set passwords for basic authorization htpasswd
Get SELinux Booleans for Apache getsebool -a | grep ‘httpd’
Directory Directive Basic Auth .htaccess file
<Directory “/var/www/html/files”> Options Indexes Multiviews
Options Indexes MultiViews Require group admins
Require group admins AuthType Basic
AllowOverride None AuthName “Password Required”
Order allow,deny AuthUserFile /etc/httpd/password.txt
Allow from all AuthGroupFile /etc/httpd/group.txt
</Directory>
Complete Guide to Red Hat Enterprise Linux 9 with Grant McWilliams 1 of 2
Options Access Control
ExecCGI Allow execution of AuthType Set basic
CGI scripts authentication
FollowSymLinks Follow symbolic links AuthName Label/comment
Includes Permit server-side AuthBasicProvider Type of
includes authentication
Indexes Show index if no AuthUserFile File for user
index.html passwords
MultiViews Allow substitution of AuthGroupFile File for group
extensions passwords
All All options minus Require user, valid-user,
MultiViews group, ip, host, all
Virtual Host Directive
<VirtualHost *:80>
DocumentRoot /var/www/html/testhost.com/
ServerAdmin
[email protected] ServerName testhost.com
ErrorLog logs/testhost-error.log
CustomLog logs/testhost-access.log common
</VirtualHost>
Complete Guide to Red Hat Enterprise Linux 9 with Grant McWilliams 2 of 2