How To Install Apache on CentOS 8
Command:
$ sudo -l User devconnected may run the following commands on localhost: (ALL) ALL
$ sudo systemctl status firewalld
$ sudo yum update
$ sudo yum install httpd
$ sudo systemctl start httpd
$ sudo systemctl enable httpd Created symlink /etc/systemd/system/multi-user.target.wants/httpd.service -> /usr/lib/systemd/system/httpd.service
$ sudo systemctl status httpd
$ httpd -v
$ hostname -I | awk ‘{print $1}’ 192.168.178.27
$ curl :80
$ sudo firewall-cmd --permanent --zone=public --add-service=http
$ sudo firewall-cmd --permanent --zone=public --add-service=https
$ sudo firewall-cmd --reload$ sudo firewall-cmd --list-all | grep services
services : cockpit dhcpv6-client http https ssh$ sudo systemctl restart httpd
$ sudo systemctl stop httpd
$ sudo systemctl start httpd
$ sudo systemctl reload httpd
$ sudo systemctl enable httpd
$ sudo systemctl disable httpd
$ sudo mkdir -p /var/www/website.com/html$ sudo mkdir -p /var/www/website.com/log
$ cd /var/www/website.com/html
$ sudo vi index.html
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Website.com</title>
<meta name="description" content="Website.com Homepage">
<meta name="author" content="devconnected">
</head>
<body>
This is the index page of website.com, welcome!
</body>
</html>
$ sudo mkdir -p /etc/httpd/sites-enabled /etc/httpd/sites-available
$ sudo vi /etc/httpd/conf/httpd.conf # Load config files in the "/etc/httpd/conf.d" directory if any IncludeOptional conf.d/*.conf
IncludeOptional sites-enabled/*.conf
$ sudo vi /etc/httpd/sites-available/website.com.conf
ServerName website.com
ServerAlias www.website.com
DocumentRoot /var/www/website.com/html
ErrorLog /var/www/website.com/log/error.log
CustomLog /var/www/website.com/log/requests.logcombined
$ sudo apachectl configtest Syntax OK
$ sudo ln -s /etc/httpd/sites-available/website.com.conf /etc/httpd/sites-enabled/website.com.conf
$ sudo setsebool -P httpd_unified 1
$ sudo systemctl restart httpd