Red Hat
is a very popular choice of Linux
distribution for server deployment and Apache
is one of the most popular web server software. Red Hat
and Apache
is then one of the more popular combination for web server deployment while CentOS
is being used as a free replacement fr Red Hat
.
Apache
is fully supported by both Red Hat
and CentOS
and can easily be installed from the command line using yum
.
httpd
package using yum
. $ 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
Apache
options as necessary.$ sudo vi /etc/httpd/conf/httpd.conf
Apache
configuration for errors. $ 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
httpd
service once Apache
configuration contains no error. $ sudo systemctl restart httpd
httpd
service to automatically start during system boot.$ sudo systemctl enable httpd Created symlink /etc/systemd/system/multi-user.target.wants/httpd.service → /usr/lib/systemd/system/httpd.service.
http
and/or https
services to the firewall. $ sudo firewall-cmd --permanent --add-service=http --add-service=https success
$ sudo firewall-cmd --reload success
Apache
web server is up and running. $ 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.