Mục tiêu thực hành:
- Cài đặt gói Apache v2.4 trên CentOS 7.
- Kiểm tra Web Server sau khi cài đặt Apache v.2.4.
- Quản lý tiến trình Apache Process.
- Cài đặt gói Development Tools trên CentOS 7.
Các bước triển khai:
Cài đặt gói Apache v2.4 trên CentOS 7.
- Cập nhật các gói cài đặt trên CentOS 7.
sudo yum -y update
sudo reboot
- Once the packages are updated, install the Apache package.
sudo yum update httpdsudo yum install httpd
Kiểm tra Web Server sau khi cài đặt Apache v.2.4.
- Khởi động và kiểm tra trạng thái của Web Server.
[root@localhost ~]# sudo systemctl start httpd[root@localhost ~]# sudo systemctl status httpd● httpd.service - The Apache HTTP ServerLoaded: loaded (/usr/lib/systemd/system/httpd.service; disabled; vendor preset: disabled)Active: active (running) since Tue 2021-05-04 14:17:42 +07; 1h 22min agoDocs: man:httpd(8)man:apachectl(8)Main PID: 8240 (httpd)Status: "Total requests: 12; Current requests/sec: 0; Current traffic: 0 B/sec"CGroup: /system.slice/httpd.service├─8240 /usr/sbin/httpd -DFOREGROUND├─8241 /usr/sbin/httpd -DFOREGROUND├─8242 /usr/sbin/httpd -DFOREGROUND├─8243 /usr/sbin/httpd -DFOREGROUND├─8244 /usr/sbin/httpd -DFOREGROUND├─8245 /usr/sbin/httpd -DFOREGROUND├─8248 /usr/sbin/httpd -DFOREGROUND├─8249 /usr/sbin/httpd -DFOREGROUND└─8250 /usr/sbin/httpd -DFOREGROUNDMay 04 14:17:42 localhost.localdomain systemd[1]: Starting The Apache HTTP Server...May 04 14:17:42 localhost.localdomain httpd[8240]: AH00558: httpd: Could not reliably determine the server's fully qualified domain name, using localhost.localdomain. Set the 'ServerName'... this messageMay 04 14:17:42 localhost.localdomain systemd[1]: Started The Apache HTTP Server.Hint: Some lines were ellipsized, use -l to show in full.[root@localhost ~]#
- Kiểm tra IP hiện tại của Web Server.
[root@localhost ~]# hostname -I192.168.100.122[root@localhost ~]#
- Cài gói PHP trước khi kiểm tra kết nối HTTP tới Web Server bằng đường dẫn http://192.168.100.122
[root@localhost ~]# curl -4 192.168.100.122
Quản lý tiến trình Apache Process.
sudo systemctl stop httpdsudo systemctl start httpdsudo systemctl restart httpd
- Khởi động lại dịch vụ nếu có bất kỳ sự thay đổi nào liên quan đến HTTP source.
sudo systemctl reload httpd
- Kích hoạt dịch vụ khởi động cùng với CentOS 7.
sudo systemctl disable httpdsudo systemctl enable --now httpd
Cài đặt gói Development Tools trên CentOS 7.
sudo yum -y groupinstall "Development Tools"
sudo yum -y install httpd httpd-devel
Mọi thắc mắc các bạn vui lòng liên hệ với mình thông qua kênh Zalo (Jade Bùi) 076.877.2021.
0 comments