1.下载httpd-2.2.21.tar.gz
可以用命令# wget -c http://labs.renren.com/apache-mirror//httpd/httpd-2.2.21.tar.gz
2.安装Apache
#tar -zxvf httpd-2.2.21.tar.gz
#cd httpd-2.2.21
#./configure
#make
#make install
#/usr/local/apache2/bin/apachectl start //启动apache
3.修改配置文件
用KWrite打开/usr/local/apache2/conf/httpd.conf文件,找到
include conf/extra/httpd-vhosts.conf,将前面的#去掉,
用KWrite打开/usr/local/apache2/conf/extra/httpd-vhosts.conf
4.httpd-vhosts.conf内容如下
ServerName 192.168.1.2:80
NameVirtualHost 192.168.1.2
ServerAdmin webmaster@dummy-host.example.com
DocumentRoot "/usr/local/apache2/htdocs"
ServerName 192.168.1.2
#ServerAlias www.dummy-host.example.com
#ErrorLog "logs/dummy-host.example.com-error_log"
#CustomLog "logs/dummy-host.example.com-access_log" common
ServerAdmin webmaster@dummy-host.example.com
DocumentRoot "/usr/local/apache2/htdocs/upload"
ServerName test1.www.dga.com
#ServerAlias test1.www.dga.com
#ErrorLog "logs/dummy-host.example.com-error_log"
#CustomLog "logs/dummy-host.example.com-access_log" common
5.httpd-vhosts.conf内容说明
a.重启apache服务
#usr/local/apache2/bin/apachectl stop
#usr/local/apache2/bin/apachectl start
b. usr/local/apache2/htdocs下需建立upload文件夹
c. www.dga.com是域名
d. DNS服务器需将192.168.1.2指向test1.www.dga.com
BeefyMiracle 于 2012-12-21 12:29:43发表:
{:2_93:}
johnysqlinux 于 2011-12-12 12:29:29发表:
[i=s] 本帖最后由 johnysqlinux 于 2011-12-14 08:29 编辑 [/i]
好多网上的贴子是更改httpd.conf不是更改httpd-vhosts.conf,到处找贴子,通过贴子的只言片语找到了方法