作者:六九四四708 | 来源:互联网 | 2017-07-17 18:03
[i=s] 本帖最后由 johnysqlinux 于 2011-12-14 10:11 编辑
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