Red Hat is a prevalent choice of Linux distribution for server deployment, and Apache is one of the most popular web server software. This makes Red Hat and Apache the more popular web server deployment combinations.
CentOS is a free replacement for Red Hat Enterprise Linux, and Fedora is geared more towards the end-user. Both Red Hat variants fully support Apache and can be installed from the command line using yum or dnf.
$ sudo yum install --assumeyes httpd [sudo] password for user: Last metadata expiration check: 0:04:30 ago on Mon 17 Feb 2020 05:37:42 PM EST. Dependencies resolved. ===================================================================================================== Package Arch Version Repository Size ===================================================================================================== Installing: httpd x86_64 2.4.37-16.module_el8.1.0+256+ae790463 AppStream 1.7 M Installing dependencies: apr x86_64 1.6.3-9.el8 AppStream 125 k apr-util x86_64 1.6.1-6.el8 AppStream 105 k centos-logos-httpd noarch 80.5-2.el8 AppStream 24 k httpd-filesystem noarch 2.4.37-16.module_el8.1.0+256+ae790463 AppStream 35 k httpd-tools x86_64 2.4.37-16.module_el8.1.0+256+ae790463 AppStream 103 k mod_http2 x86_64 1.11.3-3.module_el8.1.0+213+acce2796 AppStream 158 k Installing weak dependencies: apr-util-bdb x86_64 1.6.1-6.el8 AppStream 25 k apr-util-openssl x86_64 1.6.1-6.el8 AppStream 27 k Enabling module streams: httpd 2.4 Transaction Summary ===================================================================================================== Install 9 Packages Total download size: 2.3 M Installed size: 6.6 M
$ sudo vi /etc/httpd/conf/httpd.conf
Related: Guide listing for Apache
$ sudo apachectl configtest AH00558: httpd: Could not reliably determine the server's fully qualified domain name, using fe80::e5f:4565:1b9c:6e87. Set the 'ServerName' directive globally to suppress this message Syntax OK
Related: How to check Apache configuration
$ sudo systemctl restart httpd
$ sudo systemctl enable httpd Created symlink /etc/systemd/system/multi-user.target.wants/httpd.service → /usr/lib/systemd/system/httpd.service.
$ sudo firewall-cmd --permanent --add-service=http --add-service=https success
$ sudo firewall-cmd --reload success
$ curl 127.0.0.1 <?xml version="1.0" encoding="utf-8"?> <!DOCTYPE HTML> <html lang="en"> <head> <title>CentOS 提供的 Apache HTTP 服务器测试页</title> <meta charset="utf-8"/> <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"/> <link rel="shortcut icon" href="http://www.centos.org/favicon.ico"/> <link rel="stylesheet" media="all" href="noindex/common/css/bootstrap.min.css"/> <link rel="stylesheet" media="all" href="noindex/common/css/styles.css"/> </head> ##### snipped
Comment anonymously. Login not required.