上善若水,不浮不沉!
分类: LINUX
2013-02-01 16:49:34
配置虚拟主机
1.准备软件包
httpd-2.4.3.tar.bz2
2.进行安装
tar -jxvf httpd-2.4.3.tar.bz2
./configure --prefix=/usr/local/apache
make
make install
3.配置虚拟主机
1>给主机配置多个Ip地址
2>在/usr/local/apache/conf/httpd.conf 末尾添加站点配置
ServerAdmin //设置web管理员的E-mail地址,系统连接出错,访问者能将错误情况及时报告给web管理员
DocumentRoot /usr/local/apache/htdocs///用来指定一个网站的存放目录
ServerName //配置服务器的Internet主机名
ErrorLog /usr/local/apache/logs/.log//用来指定错误记录文件和路径
ServerAdmin huo@die2.com
DocumentRoot /usr/local/apache/htdocs/
ServerName
ErrorLog /usr/local/apache/logs/.log
3>建立两个站点的目录
mkdir /var/local/apache/htdocs/
mkdir /var/local/apache/htdocs/
4>复制站点内容
cp path1 /usr/local/apache/htdocs/1.com //path1为第一站点源路径
cp path2 /usr/local/apache/htdocs/ //path2为第一站点源路径
5>设置文件权限
chmod 755 -R /usr/local/apache/htdocs/1.com
chmod 755 -R /usr/local/apache/htdocs/2.com
6>重启httpd服务
/usr/local/apache/bin/apachect1 restart
7>分别以不同的Ip访问。