linux系统中部署apache虚拟主机功能(基于IP地址部署多个网站)

虚拟主机功能:一台物理服务器分割为多个“虚拟的服务器”,实现一台物理服务器部署多个网站的功能。

方式:

基于IP地址

基于主机域名

基于端口号

以下实验完成基于IP地址的虚拟主机功能,使用两台虚拟机完成,PC1为服务器端,IP设定为3个(192.168.10.100,192.168.10.101,192.168.10.102),PC2为客户机端,IP设为1个,192.168.10.20.

1、在PC1服务器端安装apache服务

[root@PC1 ~]# yum install httpd -y Loaded plugins: langpacks, product-id, subscription-manager This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register. Repodata is over 2 weeks old. Install yum-cron? Or run: yum makecache fast rhel7 | 4.1 kB 00:00 Resolving Dependencies --> Running transaction check ---> Package httpd.x86_64 0:2.4.6-17.el7 will be installed --> Processing Dependency: httpd-tools = 2.4.6-17.el7 for package: httpd-2.4.6-17.el7.x86_64 --> Processing Dependency: /etc/mime.types for package: httpd-2.4.6-17.el7.x86_64 --> Processing Dependency: libapr-1.so.0()(64bit) for package: httpd-2.4.6-17.el7.x86_64 --> Processing Dependency: libaprutil-1.so.0()(64bit) for package: httpd-2.4.6-17.el7.x86_64 --> Running transaction check ---> Package apr.x86_64 0:1.4.8-3.el7 will be installed ---> Package apr-util.x86_64 0:1.5.2-6.el7 will be installed ---> Package httpd-tools.x86_64 0:2.4.6-17.el7 will be installed ---> Package mailcap.noarch 0:2.1.41-2.el7 will be installed --> Finished Dependency Resolution Dependencies Resolved ================================================================================ Package Arch Version Repository Size ================================================================================ Installing: httpd x86_64 2.4.6-17.el7 rhel7 1.2 M Installing for dependencies: apr x86_64 1.4.8-3.el7 rhel7 103 k apr-util x86_64 1.5.2-6.el7 rhel7 92 k httpd-tools x86_64 2.4.6-17.el7 rhel7 77 k mailcap noarch 2.1.41-2.el7 rhel7 31 k Transaction Summary ================================================================================ Install 1 Package (+4 Dependent packages) Total download size: 1.5 M Installed size: 4.3 M Downloading packages: -------------------------------------------------------------------------------- Total 6.0 MB/s | 1.5 MB 00:00 Running transaction check Running transaction test Transaction test succeeded Running transaction Installing : apr-1.4.8-3.el7.x86_64 1/5 Installing : apr-util-1.5.2-6.el7.x86_64 2/5 Installing : httpd-tools-2.4.6-17.el7.x86_64 3/5 Installing : mailcap-2.1.41-2.el7.noarch 4/5 Installing : httpd-2.4.6-17.el7.x86_64 5/5 rhel7/productid | 1.6 kB 00:00 Verifying : mailcap-2.1.41-2.el7.noarch 1/5 Verifying : httpd-tools-2.4.6-17.el7.x86_64 2/5 Verifying : apr-1.4.8-3.el7.x86_64 3/5 Verifying : apr-util-1.5.2-6.el7.x86_64 4/5 Verifying : httpd-2.4.6-17.el7.x86_64 5/5 Installed: httpd.x86_64 0:2.4.6-17.el7 Dependency Installed: apr.x86_64 0:1.4.8-3.el7 apr-util.x86_64 0:1.5.2-6.el7 httpd-tools.x86_64 0:2.4.6-17.el7 mailcap.noarch 0:2.1.41-2.el7 Complete!

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/zzysgy.html