???????壩????????????
????????????ú???????????????Ч????????????????????????????“????”??????????????????WEB????????翴????Щ????????????????????????????????????????????????????????????????????????????????????
??????????????????????Apache??????????????????????????????ú??????????????IP?????????????????????
?????????????????IP???????????ɡ????????????????????????ж????????IP??????????????IP?????????????????????????????IP????????????????????????????????????IP???????????????????IP??????????????????????????IP????????????????ò???????????????????????
????1??IP??????????????????
???????????CentOS?????????IP??192.168.0.94???????????8080??8081??????????????????????httpd.conf??
Listen 8080
Listen 8081
<VirtualHost 192.168.0.94:8080>
DocumentRoot /var/www/web1
DirectoryIndex index.html index.htm
HostNameLookups off
</VirtualHost>
<VirtualHost 192.168.0.94:8081>
DocumentRoot /var/www/web2
DirectoryIndex index.html index.htm
HostNameLookups off
</VirtualHost>
??????????????ɡ?
????2?????????????IP?????????????????94???????95??
<VirtualHost 192.168.0.94>
ServerName 192.168.0.94:80
DocumentRoot /var/www/web1
DirectoryIndex index.html index.htm
</VirtualHost>
<VirtualHost 192.168.0.95>
ServerName 192.168.0.95:80
DocumentRoot /var/www/web2
DirectoryIndex index.html index.htm
</VirtualHost>
????????????????????????????????????????????IP??
????ifconfig eth0:1 192.168.0.95
????3????????????????????
????NameVirtualHost 192.168.0.94??
????<VirtualHost www.web1.com>
????ServerName www.web1.com:80
????DocumentRoot /var/www/web1
????DirectoryIndex index.html index.htm
????</VirtualHost>
????<VirtualHost www.web2.com>
????ServerName www.web2.com:80
????DocumentRoot /var/www/web2
????DirectoryIndex index.html index.htm
????</VirtualHost>
????????????linux?μ?/etc/hosts???????windows??C:WINNTsystem32driversetchosts????У?????
????192.168.0.94 www.web1.com
????192.168.0.94 www.web2.com
???????????????????÷???????????restart??
??????????????PHP???
??????????????APACHE????????????HTML????HTM??β?????????????PHP???y??????2?????
????#rpm -qa | grep php????????????????????PHP?????????а?????????????е?CENTOS???????????????????
????#rpm -ivh php-common-5.1.6-20.el5.i386.rpm
????#rpm -ivh php-cli-5.1.6-20.el5.i386.rpm
????#rpm -ivh php-5.1.6-20.el5.i386.rpm
???????????/var/www/html??????????ok.php?????д???????????
?????????????????“http://web??????IP/ok.php”?????????
????????????????Щ????????.php3??.php4???β????????????php??????????н?????????/etc/httpd/conf.d/php.conf
???????“#AddType application/x-httpd-php-source .php”?“AddType application/x-httpd-php-source .php .php3 .php4”??????#????.php3/4????п???
???????1??
?????????CentOS????÷?????????Web????????????“/opt/???????????”??′???????????????????????????“exam”??????????????????????html??????“index.htm”??<body>????????“д?????????????”??????apache??????????????????user1??????123456????user2??????654321?????????????????“ip/exam/:8080”??????????????????????????ɡ?
???????2??
???????????????????????????????????????????????????????????????192.168.0.101??web1??192.168.0.102??web2??192.168.0.100????www.cba.com??www.nba.com?????????