Linux 基于端口的虚拟主机配置

[[email protected] 桌面]$ cd/mnt/cdrom

[[email protected] cdrom]$ ll

总用量 0

[[email protected] cdrom]$ mount /dev/cdrom/mnt/cdrom

mount: only root can do that

[[email protected] cdrom]$ su root

密码:

[[email protected] cdrom]# mount /dev/cdrom/mnt/cdrom

mount: block device /dev/sr0 iswrite-protected,

mounting read-only

[[email protected] cdrom]# ll

总用量 0

[[email protected] cdrom]# cd /mnt/cdrom

[[email protected] cdrom]# ll

总用量 3885

dr-xr-xr-x. 3 whch whch   2048 11月 17 2011 EFI

-r--r--r--. 3 whch whch   8794 9月  2 2010 EULA

-r--r--r--. 3 whch whch  18092 6月 29 2010 GPL

dr-xr-xr-x. 3 whch whch   2048 11月 17 2011

HighAvailability

dr-xr-xr-x. 3 whch whch   2048 11月 17 2011 images

dr-xr-xr-x. 2 whch whch   2048 11月 17 2011 isolinux

dr-xr-xr-x. 3 whch whch   2048 11月 17 2011

LoadBalancer

-r--r--r--. 2 whch whch    114 11月 17 2011 media.repo

dr-xr-xr-x. 2 whch whch 649216 11月 17 2011Packages

-r--r--r--. 2 whch whch  16435 9月  2 2010 README

-r--r--r--. 3 whch whch 172833 11月 15 2011RELEASE-

NOTES-as-IN.html

-r--r--r--. 3 whch whch 178359 11月 15 2011RELEASE-

NOTES-bn-IN.html

-r--r--r--. 3 whch whch 109593 11月 15 2011RELEASE-

NOTES-de-DE.html

-r--r--r--. 3 whch whch 101919 11月 15 2011RELEASE-

NOTES-en-US.html

-r--r--r--. 3 whch whch 109920 11月 15 2011RELEASE-

NOTES-es-ES.html

-r--r--r--. 3 whch whch 114396 11月 15 2011RELEASE-

NOTES-fr-FR.html

-r--r--r--. 3 whch whch 166662 11月 15 2011RELEASE-

NOTES-gu-IN.html

-r--r--r--. 3 whch whch 168104 11月 15 2011RELEASE-

NOTES-hi-IN.html

-r--r--r--. 3 whch whch 108343 11月 15 2011RELEASE-

NOTES-it-IT.html

-r--r--r--. 3 whch whch 123332 11月 15 2011RELEASE-

NOTES-ja-JP.html

-r--r--r--. 3 whch whch 189916 11月 15 2011RELEASE-

NOTES-kn-IN.html

-r--r--r--. 3 whch whch 111469 11月 15 2011RELEASE-

NOTES-ko-KR.html

-r--r--r--. 3 whch whch 200245 11月 15 2011RELEASE-

NOTES-ml-IN.html

-r--r--r--. 3 whch whch 172372 11月 15 2011RELEASE-

NOTES-mr-IN.html

-r--r--r--. 3 whch whch 168580 11月 14 2011RELEASE-

NOTES-or-IN.html

-r--r--r--. 3 whch whch 152138 11月 15 2011RELEASE-

NOTES-pa-IN.html

-r--r--r--. 3 whch whch 108164 11月 15 2011RELEASE-

NOTES-pt-BR.html

-r--r--r--. 3 whch whch 112882 11月 15 2011RELEASE-

NOTES-ru-RU.html

-r--r--r--. 3 whch whch   5125 5月  4 2010 RELEASE-

NOTES-si-LK.html

-r--r--r--. 3 whch whch  84168 4月 20 2011 RELEASE-

NOTES-ta-IN.html

-r--r--r--. 3 whch whch 180112 11月 15 2011RELEASE-

NOTES-te-IN.html

-r--r--r--. 3 whch whch 203953 11月 15 2011RELEASE-

NOTES-zh-CN.html

-r--r--r--. 3 whch whch 197545 11月 15 2011RELEASE-

NOTES-zh-TW.html

dr-xr-xr-x. 2 whch whch   4096 11月 17 2011 repodata

dr-xr-xr-x. 3 whch whch   2048 11月 17 2011

ResilientStorage

-r--r--r--. 3 whch whch   3375 11月  8 2011 RPM-GPG-

KEY-redhat-beta

-r--r--r--. 3 whch whch   3211 11月  8 2011 RPM-GPG-

KEY-redhat-release

dr-xr-xr-x. 3 whch whch   2048 11月 17 2011

ScalableFileSystem

dr-xr-xr-x. 3 whch whch   2048 11月 17 2011 Server

-r--r--r--. 1 whch whch   9435 11月 17 2011 TRANS.TBL

[[email protected] cdrom]# cd Server

[[email protected] Server]# ll

总用量 135

-r--r--r--. 2 whch whch 132839 11月 17 2011listing

dr-xr-xr-x. 2 whch whch   4096 11月 17 2011 repodata

-r--r--r--. 1 whch whch    439 11月 17 2011 TRANS.TBL

[[email protected] Server]# cd Packages

bash: cd: Packages: 没有那个文件或目录

[[email protected] Server]# cd ../

[[email protected] cdrom]# cd Packages

[[email protected] Packages]# find http*

httpd-2.2.15-15.el6.x86_64.rpm

httpd-devel-2.2.15-15.el6.i686.rpm

httpd-devel-2.2.15-15.el6.x86_64.rpm

httpd-manual-2.2.15-15.el6.noarch.rpm

httpd-tools-2.2.15-15.el6.x86_64.rpm

[[email protected] Packages]# rpm -ivhhttpd-2.2.15-

15.el6.x86_64.rpmLinux 基于端口的虚拟主机配置Linux 基于端口的虚拟主机配置

warning: httpd-2.2.15-15.el6.x86_64.rpm:Header V3

RSA/SHA256 Signature, key ID fd431d51:NOKEY

Preparing...                                           

              

###########################################[100%]

        packagehttpd-2.2.15-15.el6.x86_64 is already

installed

[[email protected] Packages]# rpm -q httpd

httpd-2.2.15-15.el6.x86_64

[[email protected] Packages]# cd /var/www

[[email protected] www]# mkdir 20151514217

[[email protected] www]# mkdir whc

[[email protected] www]# ll

总用量 24

drwxr-xr-x. 2 root root 4096 10月 26 20:1920151514217

drwxr-xr-x. 2 root root 4096 10月  6 2011 cgi-bin

drwxr-xr-x. 3 root root 4096  9月  9 12:15 error

drwxr-xr-x. 2 root root 4096 10月  6 2011 html

drwxr-xr-x. 3 root root 4096  9月  9 12:15 icons

drwxr-xr-x. 2 root root 4096 10月 26 20:20whc

[[email protected] www]# vi20151514217/index.html

[[email protected] www]# vi whc/index.html

[[email protected] www]# vi/etc/httpd/conf/httpd.conf

[[email protected] www]# ll

总用量 24

drwxr-xr-x. 2 root root 4096 10月 26 20:2320151514217

drwxr-xr-x. 2 root root 4096 10月  6 2011 cgi-bin

drwxr-xr-x. 3 root root 4096  9月  9 12:15 error

drwxr-xr-x. 2 root root 4096 10月  6 2011 html

drwxr-xr-x. 3 root root 4096  9月  9 12:15 icons

drwxr-xr-x. 2 root root 4096 10月 26 20:25whc

[[email protected] www]# cd /etc/httpd/conf

[[email protected] conf]# ll

总用量 52

-rw-r--r--. 1 root root 34437 10月 26 20:47httpd.conf

-rw-r--r--. 1 root root 13139 10月  6 2011 magic

[[email protected] conf]# cd httpd.conf

bash: cd: httpd.conf: 不是目录

[[email protected] conf]# cd ../

[[email protected] httpd]# ll

总用量 8

drwxr-xr-x. 2 root root 4096 10月 26 20:47conf

drwxr-xr-x. 2 root root 4096  9月  9 12:15 conf.d

lrwxrwxrwx. 1 root root   19  9月  9 12:15 logs ->

../../var/log/httpd

lrwxrwxrwx. 1 root root   29  9月  9 12:15 modules ->

../../usr/lib64/httpd/modules

lrwxrwxrwx. 1 root root   19  9月  9 12:15 run ->

../../var/run/httpd

[[email protected] httpd]# cd conf.d

[[email protected] conf.d]# ll

总用量 12

-rw-r--r--. 1 root root 118  5月 19 2009mod_dnssd.conf

-rw-r--r--. 1 root root 392 10月  6 2011 README

-rw-r--r--. 1 root root 299  5月 20 2009welcome.conf

[[email protected] conf.d]# cd README

bash: cd: README: 不是目录

[[email protected] conf.d]# cd conf

bash: cd: conf: 没有那个文件或目录

[[email protected] conf.d]# cd ../

[[email protected] httpd]# find vhosts.conf

find: “vhosts.conf”: 没有那个文件或目录

[[email protected] httpd]# find *.conf

find: “*.conf”: 没有那个文件或目录

[[email protected] httpd]# cd conf

[[email protected] conf]# ll

总用量 52

-rw-r--r--. 1 root root 34437 10月 26 20:47httpd.conf

-rw-r--r--. 1 root root 13139 10月  6 2011 magic

[[email protected] conf]# cd magic

bash: cd: magic: 不是目录

[[email protected] conf]# cd ../

[[email protected] httpd]# cd conf.d

[[email protected] conf.d]# ll

总用量 12

-rw-r--r--. 1 root root 118  5月 19 2009mod_dnssd.conf

-rw-r--r--. 1 root root 392 10月  6 2011 README

-rw-r--r--. 1 root root 299  5月 20 2009welcome.conf

[[email protected] conf.d]# vi mod_dnssd.conf

[[email protected] conf.d]# vi welcome.conf

[[email protected] conf.d]# vi README

[[email protected] conf.d]# vi ../conf/httpd.conf

[[email protected] conf.d]# cd /

[[email protected] /]# service httpd start

Starting httpd: httpd: Syntax error on line1011 of

/etc/httpd/conf/httpd.conf: Expected</Directory> but

saw </VirtualHost>

                                                       

  [FAILED]

[[email protected] /]# vi/etc/httpd/conf/httpd.conf

[[email protected] /]# service httpd start

Starting httpd:                                        

  [  OK  ]

[[email protected] /]#