[root@localhost ~]# nmcli connection modify ens160 +ipv4.addresses 192.168.228.130/24[root@localhost ~]# nmcli connerction up ens160
Connection successfully activated (D-Bus active path: /org/freedesktop/NetworkManager/ActiveConnection/4)
Второй шаг, создайте каталог и содержимое веб-страницы.
[root@localhost ~]# mkdir -pv /www/qp
mkdir: created directory '/www'
mkdir: created directory '/www/qp'[root@localhost ~]# tree /www/
/www/
└── qp
1 directory, 0 files
[root@localhost ~]# echo "my name is qp" > /www/qp/index.html[root@localhost ~]# cat /www/qp/index.html
my name is qp
Третий шаг, ввод и запись файла конфигурации
[root@localhost ~]# cd /etc/httpd/conf.d/[root@localhost conf.d]# vim ip10.conf# 在里面配置文件<virtualhost 192.168.228.10>
servername 192.168.228.10
documentroot /www/qp
</virtualhost><directory /www/qp>
allowoverride none
require all granted
</directory>
Четвертый шаг, перезапустите службу
[root@localhost conf.d]systemctl restart httpd
Enter TLS private key passphrase for www.ceshi.com:443 (RSA):*******
Шаг пятый, отключите брандмауэр и selinux
# 首先关闭防火墙[root@localhost conf.d]# systemctl stop firewalld[root@localhost conf.d]# systemctl status firewalld
● firewalld.service - firewalld - dynamic firewall daemon
Loaded: loaded (/usr/lib/systemd/system/firewalld.service; enabled; vendor preset: enabled)
Active: inactive (dead) since Wed 2022-11-16 23:32:49 CST; 12s ago
Docs: man:firewalld(1)
Process: 1083ExecStart=/usr/sbin/firewalld --nofork--nopid$FIREWALLD_ARGS(code=exited, stat>
Main PID: 1083(code=exited, status=0/SUCCESS)
Nov 1622:52:29 localhost.localdomain systemd[1]: Starting firewalld - dynamic firewall daemon...
Nov 1622:52:30 localhost.localdomain systemd[1]: Started firewalld - dynamic firewall daemon.
Nov 1622:52:31 localhost.localdomain firewalld[1083]: WARNING: AllowZoneDrifting is enabled. Thi>
Nov 1623:32:49 localhost.localdomain systemd[1]: Stopping firewalld - dynamic firewall daemon...
Nov 1623:32:49 localhost.localdomain systemd[1]: firewalld.service: Succeeded.
Nov 1623:32:49 localhost.localdomain systemd[1]: Stopped firewalld - dynamic firewall daemon.
# 其次关闭selinux[root@localhost conf.d]# getenforce
Enforcing
[root@localhost conf.d]# setenforce 0[root@localhost conf.d]# getenforce
Permissive
Шестой шаг, проверка доступа
[root@localhost conf.d]# curl 192.168.228.11
my name is qp