服务器下
[root@gaojingbo ~]# ssh 192.168.122.238
[root@localhost ~]# yum -y install httpd mariadb-server mariadb php php-mysql gd php-gd
[root@localhost ~]# ip a
192.168.122.238
[root@localhost ~]# systemctl stop firewalld.service
[root@localhost ~]# systemctl disable firewalld.service
Removed symlink /etc/systemd/system/dbus-org.fedoraproject.FirewallD1.service.
Removed symlink /etc/systemd/system/basic.target.wants/firewalld.service.
[root@localhost ~]# systemctl status firewalld.service
● firewalld.service - firewalld - dynamic firewall daemon
Loaded: loaded (/usr/lib/systemd/system/firewalld.service; disabled; vendor preset: enabled)
Active: inactive (dead)
Docs: man:firewalld(1)
Aug 20 15:22:16 localhost.localdomain systemd[1]: Starting firewalld - dynami...
Aug 20 15:22:17 localhost.localdomain systemd[1]: Started firewalld - dynamic...
Aug 20 15:35:46 kvm-server.com systemd[1]: Stopping firewalld - dynamic fire....
Aug 20 15:35:46 kvm-server.com systemd[1]: Stopped firewalld - dynamic firew....
Hint: Some lines were ellipsized, use -l to show in full.
[root@localhost ~]# mkdir /var/www/html/aaa.com
[root@localhost ~]# echo 1111 > /var/www/html/aaa.com/index.html
也可以将自己准备好的html文件 拷贝到这里
[root@localhost ~]# mkdir /var/log/httpd/aaa.com
[root@localhost ~]# vim /etc/httpd/conf.d/aaa.com.conf
<VirtualHost 192.168.122.238:80>
DocumentRoot /var/www/html/aaa.com
ServerName www.aaa.com
ServerAlias aaa.com
ErrorLog /var/log/httpd/aaa.com/error_log
CustomLog /var/log/httpd/aaa.com/access_log combined
</VirtualHost>
[root@localhost ~]# httpd -t
Syntax OK
[root@localhost ~]# systemctl restart httpd
客户端
[root@gaojingbo ~]# vim /etc/hosts
127.0.0.1 calhost localhost.localdomain localhost4 localhost4.localdomain4
::1 localhost localhost.localdomain localhost6 localhost6.localdomai n6
192.168.122.238 www.aaa.com
[root@gaojingbo ~]# firefox www.aaa.com
因篇幅问题不能全部显示,请点此查看更多更全内容