免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 777 | 回复: 0
打印 上一主题 下一主题

Fedora8中Apache服务的配置 [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2008-06-18 11:30 |只看该作者 |倒序浏览
开放源代码的Apache(阿帕奇)服务器起初由Illinois大学Urbana-Champaign的国家高级计算程序中心开发,后来Apache被开放源代码团体的成员不断地发展和加强。开始时,Apache只是Netscape网页服务器(现在是Sun ONE)的之外的开放源代码选择。渐渐地,它开始在功能和速度上超越其他Web服务器。由于Apache服务器拥有牢靠可信的美誉,因此从1995年1月以来,Apache一直是Internet上最流行的Web服务器。
/etc/httpd/conf/httpd.conf文件:
1. 全局环境设置 2.主要的服务器设置 3.虚拟主机 三部分
### Section 1: Global Environment
1.设置相对根目录的路径
ServerRoot "/etc/httpd"
2.设置Apache监听的IP地址和端口号
Listen 80
### Section 2: 'Main' server configuration
3.设置网络管理员的E—mail地址
ServerAdmin
adminMail@163.com
4.设置服务器主机名称
ServerName 192.168.1.6:80
5.设置主目录的路径
DocumentRoot "/var/www/html"
6设置默认文档
DirectoryIndex index.html index.html.var index.htm
7设置日志文件
(1)ErrorLog logs/error_log
(2)CustomLog logs/access_log combined
8.设置默认字符集
AddDefaultCharset UTF-8
一、 安装
[root@localhost Packages]# rpm -q httpd-2.2.6-3.i386
httpd-2.2.6-3
[root@localhost conf]# cd /etc/httpd/conf
[root@localhost conf]# ls
httpd.conf  magic
***************************************************************
二、 配置没有虚拟主机的
[root@localhost conf]# cd /var/www/html/
建立index.html
index.html内容
[root@localhost html]# more index.htm
        www.jw.com
www.jiwei.com
www.jiwei.com
******************************************
修改httpd.conf
[root@localhost html]# cd /etc/httpd/conf
[root@localhost conf]# vi httpd.conf
Listen 80
#ServerName
www.example.com:80
ServerName
www.jw.com:80
DocumentRoot "/var/www/html"
DirectoryIndex index.html index.html.var index.htm
[root@localhost conf]# /etc/rc.d/init.d/named start
启动 named:                                               [确定]
[root@localhost conf]# /etc/rc.d/init.d/httpd restart
停止 httpd:                                               [失败]
启动 httpd:                                               [确定]
**************************************************
三、 建立虚拟主机所用Web页面
建立/var/www/wwwjwcom/index.htm
        wwwjwcom
wwwjwcom  wwwjwcom  wwwjwcom  wwwjwcom wwwjwcom wwwjwcom
******************
建立/var/www/bbs/index.htm
        bbs/title>
bbs bbs  bbs  bbs  bbs  bbs  bbs  bbs  bbs  bbs  bbs  bbs
******************
建立/var/www/blog/index.htm
        blog
blog  blog  blog   blog  blog  blog  blog blog
******************************************************************
四、 多主机头
***********
NameVirtualHost 192.168.1.6:80      注:修改
      注:修改
    ServerAdmin
webmaster@dummy-host.example.com
    DocumentRoot /var/www/wwwjwcom/     注:修改
    ServerName
www.jw.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 /var/www/bbs      注:修改
    ServerName bbs.jw.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 /var/www/blog     注:修改
    ServerName blog.jw.com      注:修改
    ErrorLog logs/dummy-host.example.com-error_log
    CustomLog logs/dummy-host.example.com-access_log common
*********************************************************************
五、 多IP地址
********
[root@localhost conf]# cd /etc/sysconfig/network-scripts/
[root@localhost network-scripts]# cp ifcfg-eth0 ifcfg-eth1
IPADDR=192.168.1.6
修改:
IPADDR=192.168.1.8
[root@localhost /]# /etc/rc.d/init.d/network restart
正在关闭接口 eth0:                                        [确定]
关闭环回接口:                                             [确定]
弹出环回接口:                                             [确定]
弹出界面 eth0:                                            [确定]
弹出界面 eth1:                                            [确定]
NameVirtualHost 192.168.1.6:80
    ServerAdmin
webmaster@dummy-host.example.com
    DocumentRoot /var/www/wwwjwcom/  注:修改
    ServerName
www.jw.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 /var/www/bbs/  注:修改
    ServerName bbs.jw.com  注:修改
   ErrorLog logs/dummy-host.example.com-error_log
   CustomLog logs/dummy-host.example.com-access_log common
六、 重新启动
[root@localhost conf]# /etc/rc.d/init.d/httpd restart
停止 httpd:                                               [确定]
启动 httpd:                                               [确定]


本文来自ChinaUnix博客,如果查看原文请点:http://blog.chinaunix.net/u1/39714/showart_1004472.html
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP