快捷搜索:   nginx

【rhel+dns+apache】虚拟主机配置过程

【准备过程】
# mount /dev/cdrom /mnt
mount: block device /dev/cdrom is write-protected, mounting read-on

ly

# vi /etc/yum.repos.d/rhel-debuginfo.repo
[rhel-debuginfo]
name=Red Hat Enterprise Linux $releasever - $basearch
#baseurl=ftp://ftp.redhat.com/pub/redhat/linux/enterprise/$releasever/en/os/$basearch/Debuginfo/
baseurl=ftp:///mnt/Server
enabled=1
gpgcheck=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release
----------------------------------------------------------------------------------------------------------------------------------------
【DNS】

# yum install bind bind-chroot bind-libs bind-utils caching-nameserver
Running Transaction
Installing     : bind                                                         [1/3]
Installing     : caching-nameserver                                [2/3]
Installing     : bind-chroot                                              [3/3]

# rpm –qa | grep bind 检验Bind的安装情况,正常情况下会有如下安装包
ypbind-1.19-8.el5
bind-9.3.4-6.P1.el5
bind-chroot-9.3.4-6.P1.el5
bind-libs-9.3.4-6.P1.el5
bind-utils-9.3.4-6.P1.el5

# vi /var/named/chroot/etc/named.caching-nameserver.conf
     14 options {
     15         listen-on port 53 { any; };
     16         listen-on-v6 port 53 { ::1; };
     17         directory       "/var/named";
     18         dump-file       "/var/named/data/cache_dump.db";
     19         statistics-file "/var/named/data/named_stats.txt";
     20         memstatistics-file "/var/named/data/named_mem_stats.txt";
     21
     22         // Those options should be used carefully because they disable port
     23         // randomization
     24         // query-source    port 53;
     25         // query-source-v6 port 53;
     26
     27         allow-query     { any; };
     28 };
     ………………
     35 #view localhost_resolver {
     36 #       match-clients      { localhost; };
     37 #       match-destinations { localhost; };
     38 #       recursion yes;
     39 #       include "/etc/named.rfc1912.zones";
     40 #};
     41 zone "qu6zhi.com" IN {
     42        type master;
     43        file "www.qu6zhi.com";
     44 };

# cp named.caching-nameserver.conf named.conf
给用户“root”,named.conf 这个文件,群组“named”的权限。
# chown root:named named.conf

# cp localhost.zone qu6zhi.com

# vi qu6zhi.com
$TTL    86400
@               IN SOA www       root (
                                        42              ; serial (d. adams)
                                        3H              ; refresh
                                        15M             ; retry
                                        1W              ; expiry
                                        1D )            ; minimum

@               IN NS           www
ser1            IN A            218.241.143.253
ser2            IN A            218.241.143.253

# chown root:named www.qu6zhi.com
给用户“root”,www.qu6zhi.com 这个文件,群组“named”的权限。

# service iptables stop
Flushing firewall rules:                                   [ OK ]
Setting chains to policy ACCEPT: filter                    [ OK ]
Unloading iptables modules:                                [ OK ]

# service named restart
Stopping named:                                            [ OK ]
Starting named:                                            [ OK ]

# nslookup www.qu6zhi.com
Server:         218.241.143.253
Address:        218.241.143.253#53

Name:   www.qu6zhi.com
Address: 218.241.143.253

----------------------------------------------------------------------------------------------------------------------------------------
【配置 apache 虚拟机】
# yum install php mysql-server php-mysql
Dependencies Resolved

============================================================================
Package             Arch     Version              Repository          Size
============================================================================
Installing:
mysql-server        i386     5.0.45-7.el5         rhel-debuginfo     9.7 M
php                 i386     5.1.6-23.el5         rhel-debuginfo     1.2 M
php-mysql           i386     5.1.6-23.el5         rhel-debuginfo      84 k
Installing for dependencies:
apr                 i386     1.2.7-11             rhel-debuginfo     123 k
apr-util            i386     1.2.7-7.el5          rhel-debuginfo      76 k
gmp                 i386     4.1.4-10.el5         rhel-debuginfo     665 k
httpd               i386     2.2.3-22.el5         rhel-debuginfo     1.2 M
mysql               i386     5.0.45-7.el5         rhel-debuginfo     4.1 M
perl-DBD-MySQL      i386     3.0007-2.el5         rhel-debuginfo     147 k
perl-DBI            i386     1.52-2.el5           rhel-debuginfo     605 k
php-cli             i386     5.1.6-23.el5         rhel-debuginfo     2.1 M
php-common          i386     5.1.6-23.el5         rhel-debuginfo     153 k
php-pdo             i386     5.1.6-23.el5         rhel-debuginfo      63 k
postgresql-libs     i386     8.1.11-1.el5_1.1     rhel-debuginfo     196 k

Transaction Summary
============================================================================
Install     14 Package(s)        
Update       0 Package(s)        
Remove       0 Package(s)        

Total download size: 20 M

# service httpd restart
Stopping httpd:                                            [FAILED]
Starting httpd:                                            [ OK ]

# vi /etc/httpd/conf/httpd.conf

    972 NameVirtualHost *:80

    985 #<VirtualHost *:80>
    986 #    ServerAdmin [email protected]
    987 #    DocumentRoot /www/docs/dummy-host.example.com
    988 #    ServerName dummy-host.example.com
    989 #    ErrorLog logs/dummy-host.example.com-error_log
    990 #    CustomLog logs/dummy-host.example.com-access_log common
    991 #</VirtualHost>
    992 <VirtualHost *:80>
    993     DocumentRoot /var/www/html
    994     ServerName ser1.qu6zhi.com
    995 </VirtualHost>
    996 <VirtualHost *:80>
    997     DocumentRoot /var/www/html_002
    998     ServerName ser2.qu6zhi.com
    999 </VirtualHost>
顶(0)
踩(0)

您可能还会对下面的文章感兴趣:

最新评论