分兩部分來實現
一、網域名稱伺服器
hosts--> DNS
hosts:
資料容易被個人修改出錯
資料容易不一致
當資料龐大的時候維護麻煩
DNS網域名稱解析體系的特點:
資料不容易隨便讓人修改出錯
資料一致
網域名稱體系採用分層結構
www.baidu.com. <----FQDN
cn
net
org
gov
edu
bz
cc
tv
la
linux預設的DNS伺服器端軟體
bind 服務端軟體
bind-chroot 安全軟體
協議:DNS
連接埠:udp:53 tcp:53
準備:
1、原生主機名稱必須是FQDN
2、關閉selinux,iptables
3、正確的時間(同步時間)
ntpdate 10.1.1.1
設定檔存放的路徑:
bind-chroot之前
/var/named <---資料檔案
/etc/named.conf <---主設定檔
bind-chroot之後
/var/named/chroot/var/named
/var/named/chroot/etc/named.conf
配置過程:
1、主設定檔named.conf(增加你要管理的網域名稱的定義)
2、地區檔案(網域名稱的資料檔案)
3、重啟服務
例子1:正向解析 name-->ip
1、
# vim /var/named/chroot/etc/named.conf
options {
directory "/var/named";
forwarders { 10.1.1.1; };
};
zone "wych.com" IN {
type master; #類型: slave,forward,hint
file "data/master.wych.com.zone";
allow-transfer { 10.1.1.253; };
};
zone "888.com" IN {
type master; #類型: slave,forward,hint
file "data/master.888.com.zone";
allow-transfer { 10.1.1.253; };
};
zone "1.1.10.in-addr.arpa" IN {
type master;
file "data/master.1.1.10.in-addr.arpa.zone";
};
2、vi /var/named/chroot/var/named/data/master.wych.com.zone
$TTL 86400
@ IN SOA wych.com. root. (
2010072101
1M
30
1D
1H )
@ IN NS host.wych.com.
host IN A 10.1.1.101
www IN A 10.1.1.252
dns IN A 10.1.1.253
wych IN CNAME host
@ IN MX 10 mail.wych.com
mail IN CNAME host
web IN A 10.1.1.101
web IN A 10.1.1.102
web IN A 10.1.1.103
web IN A 10.1.1.104
* IN A 10.1.1.101
$GENERATE 1-10 station$ IN A 10.1.1.$
wych.com. IN A 10.1.1.101
3、vi /var/named/chroot/var/named/data/master.888.com.zone
$TTL 86400
@ IN SOA 888.com. root. (
2010072101
1M
30
1D
1H )
@ IN NS ftp.888.com.
ftp IN A 10.1.1.101
4、 vi /var/named/chroot/var/named/data/master.1.1.10.in-addr.arpa.zone
@ IN SOA 1.1.10.in-addr.arpa. root. (
2010072102
60
30
1D
1H )
@ IN NS host.wych.com.
101 IN PTR host.wych.com.
252 IN PTR www.wych.com.
253 IN PTR dsn.wych.com
$GENERATE 1-10 $ IN PTR stationi$.wych.com
5、service named restart
或者 /etc/init.d/named restart
二、apache配置步驟
apache
網頁技術:
靜態:.html .htm
動態:.asp .aspx .php .jsp .cgi
web伺服器端:
windows : IIS
Linux/Unix: apache , tomcat ,jboss , nginx
協議: http ,https
連接埠:80 , 443
========================================================
軟體包:
httpd
httpd-devel
工作目錄: /etc/httpd/
配置目錄:/etc/httpd/conf/httpd.conf
/etc/httpd/conf.d/*.conf
啟動報錯:
[root@squid ~]# service httpd restart
停止 httpd: [確定]
啟動 httpd:httpd: apr_sockaddr_info_get() failed for squid.upl.com
httpd: Could not reliably determine the server's fully qualified domain name, using 127.0.0.1 for ServerName
[確定]
提示:
hosts
設定檔:ServerName 10.1.1.21
核心參數的說明:
DocumentRoot "/var/www/html" 《---網站的根目錄
DirectoryIndex index.html index.htm default.htm default.html index.html.var index.php default.php 《--定義預設首頁
<Directory "/var/www/html">
Options Indexes FollowSymLinks
AllowOverride None <---是否支援口令驗證
Order allow,deny <---存取控制
Allow from all
</Directory>
1、 vim /etc/httpd/conf/httpd.conf
#
# Use name-based virtual hosting.
#
NameVirtualHost *:80
#
# NOTE: NameVirtualHost cannot be used without a port specifier
# (e.g. :80) if mod_ssl is being used, due to the nature of the
# SSL protocol.
#
#
# 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.
#
<VirtualHost *:80>
ServerAdmin webmaster@wych.wych.com
DocumentRoot /www
ServerName wych.wych.com
ErrorLog logs/wych.wych.com-error_log
CustomLog logs/wych.wych.com-access_log common
</VirtualHost>
<VirtualHost *:80>
ServerAdmin webmaster@ftp.888.com
DocumentRoot /ftp
ServerName ftp.888.com
ErrorLog logs/ftp.wych.com-error_log
CustomLog logs/ftp.wych.com-access_log common
</VirtualHost>