Chinaunix首页 | 论坛 | 博客
  • 博客访问: 535537
  • 博文数量: 51
  • 博客积分: 8000
  • 博客等级: 中将
  • 技术积分: 1040
  • 用 户 组: 普通用户
  • 注册时间: 2006-10-28 17:26
文章分类

全部博文(51)

文章存档

2011年(1)

2010年(20)

2009年(27)

2008年(3)

我的朋友

分类: 系统运维

2009-10-01 09:17:00

1、安装包:httpd-2.2.3-6.el5;
2、配置文件/etc/httpd/conf/httpd.conf
主要包含三大部分:全局,主服务器,虚拟主机
A)“全局”部分主要参数:
ServerRoot “/etc/httpd”        --指明存放配置文件、日志等目录;
prefork.c和worker.c   ---分别定义关于进程和线程的参数,起作用的时能二选一;
Listen  <[ip:]port>    ---监听IP和端口号;
B) 默认或主服务器主要参数:
DocumentRoot “/var/www/html”     --网页存放目录;
        --定义访问权限等;
        Options   Indexes   FollowSymLinks
        AllowOverride   None
        Order   allow,deny
        Allow   from   all

DirectoryIndex index.html default.aspx  --制定缺省网页;
Alias /dns/ “/usr/share/doc/bind-9.3.3/arm/”   --定义别名访问;
   --对别名定义访问权限等;
    Options Indexes MultiViews
    AllowOverride None
    Order allow,deny
    Allow from all

C) 虚拟主机主要参数:
基于名字的虚拟主机(多个域名共享同一个IP)和基于IP的虚拟主机(不同的域名对应不同的IP)。
NameVirtualHost  addr[:port]          --为虚拟主机分派一个IP地址
...   --包含限定制定IP的一些参数
ServerName fully-qualified-domain-name[:port]    ---定义服务器名
ServerRoot                                ---指明虚拟注意的网页目录

例子:
Listen 80
Listen 8080

NameVirtualHost 172.20.30.40:80
NameVirtualHost 172.20.30.40:8080


ServerName
DocumentRoot /www/domain-80



ServerName
DocumentRoot /www/domain-8080



ServerName
DocumentRoot /www/otherdomain-80



ServerName
DocumentRoot /www/otherdomain-8080

3、启动:httpd -S; service httpd start

4、启用443监听:
# a2enmod ssl
# cat /etc/apache2/ports.conf
Listen 192.168.1.31:80

    Listen 192.168.1.31:443

# cat /etc/apache2/conf.d/virtualhost.conf
NameVirtualHost 192.168.1.31:80
NameVirtualHost 192.168.1.31:443


ServerName
DocumentRoot /media/disk/nonemoo/var/www/moodisk
DirectoryIndex index.php

# /etc/init.d/apache2 force-reload

阅读(2569) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~