背景:
阅读新闻
实现1个Apache上部署3个网站的实验
[日期:2012-12-03] 来源:Linux社区 作者:hefajun [字体:]
一、环境
需要两台虚理机 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
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
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
测试结果见图
相关资讯 Apache配置
本文评论 查看全部评论 (0)
尊重网上道德,遵守中华人民共和国的各项有关法律法规 承担一切因您的行为而直接或间接导致的民事或刑事法律责任 本站管理人员有权保留或删除其管辖留言中的任意内容 本站有权在网站内转载或引用您的评论 参与本评论即表明您已经阅读并接受上述条款
评论声明
最新资讯