一: DNS服务器的设置
1. 编辑/etc/named.conf
// generated by named-bootconf.pl
options {
directory "/var/named";
/*
* If there is a firewall between you and nameservers you want
* to talk to, you might need to uncomment the query-source
* directive below. Previous versions of BIND always asked
* questions using port 53, but BIND 8.1 uses an unprivileged
* port by default.
*/
// query-source address * port 53;
};
//
// a caching only nameserver config
//
controls {
inet 127.0.0.1 allow { localhost; } keys { rndckey; };
};
zone "." IN {
type hint;
file "named.ca";
};
zone "mydomain.com" IN {
type master;
file "named.mydomain.com";
allow-update { none; };
};
zone "1.168.192.in-addr.arpa" IN {
type master;
file "named.mydomain.com.rev";
allow-update { none; };
};
zone "localhost" IN {
type master;
file "localhost.zone";
allow-update { none; };
};
zone "0.0.127.in-addr.arpa" IN {
type master;
file "named.local";
allow-update { none; };
};
include "/etc/rndc.key";
2. 编辑正向解析文件/var/named/named.mydomain.com
$TTL 86400
@ IN SOA my.mydomain.com. root.my.mydomain.com. (
1997022700 ; Serial
28800 ; Refresh
14400 ; Retry
3600000 ; Expire
86400 ) ; Minimum
IN NS my.mydomain.com.
IN MX 10 my.mydomain.com.
my IN A 192.168.1.50
www IN CNAME my.mydomain.com.
ftp IN CNAME my.mydomain.com.
smtp IN CNAME my.mydomain.com.
pop3 IN CNAME my.mydomain.com.
3. 编辑反向解析文件/var/named/named.mydomain.com.rev
$TTL 86400
@ IN SOA my.mydomain.com. root.ns.mydomain.com. (
1997022700 ; Serial
28800 ; Refresh
14400 ; Retry
3600000 ; Expire
86400 ) ; Minimum
IN NS my.mydomain.com.
50 IN PTR my.mydomain.com.
4. 编辑/var/named/named.local文件
$TTL 86400
@ IN SOA my.mydomain.com. root.my.mydomain.com. (
1997022700 ; Serial
28800 ; Refresh
14400 ; Retry
3600000 ; Expire
86400 ) ; Minimum
IN NS my.mydomain.com.
1 IN PTR localhost.
5. 编辑/etc/resolv.conf
# MADE-BY-RP-PPPOE
domain mydomain.com
nameserver 192.168.1.50
search localdomain
二: web服务器的设置
只需对/etc/httpd/conf/httpd.conf进行部分修改即可
ServerTokens OS
ServerRoot "/etc/httpd" 注:指定守护进程httpd的运行目录
PidFile run/httpd.pid
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" 注:指定网页文件存放位置
<IfModule mod_userdir.c
UserDir user_www 注:用于个人主页,一般为/home/user/网页文件目录
</IfModule
DirectoryIndex index.html index.htm index.php 注:指定网站首页名
AccessFileName .htaccess
Alias /manual "/var/www/manual"
<Directory "/var/www/manual"
Options Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
Allow from all
</Directory
注:以上是设置针对目录进行文件的访问控制
ScriptAlias /cgi-bin/ "/var/www/cgi-bin/"
<IfModule mod_cgid.c
Scriptsock run/httpd.cgid
</IfModule
<Directory "/var/www/cgi-bin"
AllowOverride None
Options None
Order allow,deny
Allow from all
</Directory
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地址的虚拟主机只需下面的设置即可
#<VirtualHost 202.101.2.1
# 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
#</VirtualHost
注:基于名字即一个IP地址对应多个域名
基于IP地址即每一个域名均有与之对应的IP