主配置文件/etc/httpd/conf/httpd.conf
 
ServerRoot "/etc/httpd" //指定守护进程httpd的运行目录
 
Timeout 300   //定义客户程序和服务器连接的超时间隔
 
KeepAlive Off    //定义是否支持一次连接,多次传输功能
 
MaxKeepAliveRequests 100    //一次连接可以进行的HTTP请求的最大请求次数
 
KeepAliveTimeout 15    //一次连接中的多次请求传输之间的时间
 
MaxRequestsPerChild 0        //每个子进程处理服务请求次数 0为无限次
 
Listen 80 //监听的端口
 
User apache 注:指定用户和组
Group apache
 
ServerAdmin nangshou@mydomain.com           //服务器管理员的E_MAIL地址
 
#ServerName 192.168.1.50:80              //服务器域名,通常没有dns才需要
 
UseCanonicalName Off
 
DocumentRoot "/var/www/html" //指定网页文件存放位置
 
UserDir user_www //用于个人主页,一般为/home/user/网页文件目录
 
DirectoryIndex index.html index.htm index.php //指定网站首页名
 
AccessFileName .htaccess
 
Alias /manual "/var/www/manual"
 
Options Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
Allow from all
 
//以上是设置针对目录进行文件的访问控制
ScriptAlias /cgi-bin/ "/var/www/cgi-bin/"
 
 
Scriptsock run/httpd.cgid
 
 
 
AllowOverride None
Options None
Order allow,deny
Allow from all
 
 
AddDefaultCharset GB2312 //网站支持的字符编码
 
//以下是设置虚拟主机服务所需配置的地方
#NameVirtualHost 202.101.2.1 注:基于名字的虚拟主机必须,如基于IP地址则不需要
 
#
# VirtualHost example:
# Almost any Apache directive may go into a VirtualHost container.
# The first VirtualHost section is used for requests without a known
# server name.
#//如果是基于IP地址的虚拟主机只需下面的设置即可
#
# ServerAdmin webmaster@dummy-host.example.com
# DocumentRoot /www/docs/dummy-host.example.com
# ServerName dummy-host.example.com
# ErrorLog logs/dummy-host.example.com-error_log
# CustomLog logs/dummy-host.example.com-access_log common
#
//基于名字即一个IP地址对应多个域名
基于IP地址即每一个域名均有与之对应的IP