一、环境
需要两台虚理机 ip为192.168.1.1 192。168。1.2
192.168.1.1上安装 yum install httpd php php-mysql -y
192.168.1.2上安装 ym install mysql mysql-server -y
二、httpd配置文件
[root@localhost ~]# vim /etc/httpd/conf/httpd.conf
NameVirtualHost *:80
# NOTE: NameVirtualHost cannot be used without a port specifier
# (e.g. :80) if mod_ssl is being used, due to the nature of the
# SSL protocol.
# VirtualHost example:
# Almost any Apache directive may go into a VirtualHost container.
# The first VirtualHost section is used for requests without a known
# server name.
<VirtualHost *:80>
DocumentRoot /var/www/vfast1
ServerName www.example.com
ErrorLog vfast1-error_log
CustomLog vfast1-access_log common
</VirtualHost>
<VirtualHost *:80>
DocumentRoot /var/www/vfast2
ServerName news.example.com
ErrorLog vfast2-error_log
CustomLog vfast2-access_log common
</VirtualHost>
<VirtualHost *:80>
DocumentRoot /var/www/vfast3
ServerName sport.example.com
ErrorLog vfast3-error_log
CustomLog vfast3-access_log common
</VirtualHost>
[root@localhost ~]# vim /etc/hosts
# that require network functionality will fail.
127.0.0.1 localhost.localdomain localhost
::1 localhost6.localdomain6 localhost6
192.168.1.1 www.example.com
192.168.1.1 news.example.com
192.168.1.1 sport.example.com
三、下载论坛包upload
[root@localhost ~]# mkdir -pv /var/www/vfast1
[root@localhost ~]# mkdir -pv /var/www/vfast2
[root@localhost ~]# mkdir -pv /var/www/vfast3
[root@localhost ~]# cp -fr upload/* /var/www/vfast1
[root@localhost ~]# cp -fr upload/* /var/www/vfast2
[root@localhost ~]# cp -fr upload/* /var/www/vfast3
[root@localhost ~]# cd /var/www
[root@localhost www]# ls
cgi-bin error html icons vfast1 vfast2 vfast3
[root@localhost www]# chmod -R 757 vfast1
[root@localhost www]# chmod -R 757 vfast2
[root@localhost www]# chmod -R 757 vfast3
测试结果见图