¼o½e£ºÒ»Ì¨»uÆ÷ÓÃרÏß½ÓÈeInternet×÷ΪÀ»ðǽ£¬ÔÚÄÚ²¿Íø¶ÎÉÏÓÐһ̨WWWþÎñÆ÷
£¨Redhat 6.1,Apache 1.3.9£(C)Ï£ÍuÕą»uÆ÷ÄܶÔÍaÌa¹(C)WWWþÎñÆ÷ºÍ»uÓÚapache
µÄÎļþþÎñ¡£¹(C)Ía²¿ÊÀ½ç¹«¹²ÃÎÊWWWþÎñÆ÷£¬»oÕßÍaµØÖ¹«Ë¾ÏÂÔØÐeÒªµÄÎļþ¡£
Óŵa£º ÄÚ²¿µÄWWWþÎñÆ÷ºÍÎļþþÎñÍeÈ«ÓeÍa²¿ÊÀ½ç¸o¿ª£¬²»Ö±½ÓÁ¬½Óµ½Ía²¿£¬Í¨¹ý
À»ðǽÉÏÔËÐеÄApacheþÎñÌa¹(C)¶ÔÄÚ²¿µÄ´uÀiÃÎÊ£¬ÔoÇ¿ÁË°²È«ÐÔ£¬Í¬Ê±ÔÚ
À»ðǽÉÏÔËÐеÄApacheþÎñÔËÓûuÓÚÃu×ÖµÄÐeÄaÖ÷»u¼¼Êo£¬Ê¹µÃÀ»ðǽÉϵÄ
Ö÷Ò³²»»a±»ÃÎʵ½¡£uºÏÁË×÷ΪÀ»ðǽҪÇoÔËÐÐ*þÎñÔ½ÉÙÔ½°²È«µÄ×¼Ôo¡£
ʵÏÖ½¨£ºÔÚÄÚ²¿Íø¶ÎÉϵÄApacheþÎñÆ÷£¨192.168.11.2£(C)´aeŵÄÊǹ«Ë¾Ö÷Ò³£¬¹(C)ÄÚ²¿
ºÍÍa²¿Óû§¹«¹²ÃÎÊ£¬²¢ÉeÖÃ/home/ftp/pubĿ¼ΪÎļþ´aeÅÇøÓo£¬ÓÃ
http://download.yourdomain.com/pub/À´ÃÎÊ¡£
ÔÚÀ»ðǽÉÏÉeÖÃapache´Ïo´uÀi¼¼Êo£¬ÓÉÀ»ðǽ´uÀi¶ÔÄÚ²¿Íø¶ÎÉϵÄ*ÃÎÊ¡£
²½Öe£º
Ò». ÄÚ²¿Íø¶ÎÉϵÄApache*þÎñÆ÷ÉeÖÃ
apache²ÉÓÃĬÈÏÅaÖá£Ö÷Ŀ¼Ϊ/home/httpd/html,Ö÷»uÓoÃuΪ sun.yourdomain.com,
ÇÒ±ðÃuwww.yourdomain.com, ²¢ÇÒÉeÖÃsrm.conf¼ÓÒ»ÐбðÃu¶¨ÒaÈçÏ£º
Alias /pub /home/ftp/pub/
ÇÒ¸u¸ÄĬÈÏÓ¦ÓóÌÐoÀaÐͶ¨ÒaÈçÏ£º
DefaultType application/octet-stream
×iºoÔÚ/etc/httpd/conf/access.confÖÐÔo¼ÓÒ»Ïi¶¨Òa
Options Indexes
AllowOverride AuthConfig
order allow,deny
allow from all
×¢£ºOptions IndexesÔÊÐiÔÚÕÒ²»µ½index.htmlÎļþµÄÇe¿oÏÂÔÊÐiÁгoĿ¼/ÎļþÁбi¡£
AllowOverride AuthConfigÔÊÐi×o»u±¾µÄÓû§ÃuºÍ¿ÚÁiÑeÖ¤¡£
ÕaÑuµÄ»°£¬ÄaÐeÒªÔÚ/home/ftp/pubĿ¼ÏÂÅÈe.htaccess£¬ÄÚÈÝÈçÏ£º
-------
[root@shopu pub]# more .htaccess
AuthName Branch Office Public Software Download Area
AuthType Basic
AuthUserFile /etc/.usrpasswd
require valid-user
------
È»ºoÓÃ#htpasswd -c /etc/.usrpasswd user1
ֱ𴴽¨²»Í¬µÄÔÊÐiÃÎÊ/pubÏÂÎļþþÎñµÄÍa²¿Óû§ÃuºÍ¿ÚÁi¡£
¶þ. À»ðǽÉÏ´Ïo´uÀiÅaÖãº
¼ÓÏÂÃaeµÄÐе½/etc/httpd/conf/httpd.conf
NameVirtualHost 1.2.3.4
servername www.yourdomain.com
errorlog /var/log/httpd/error_log
transferlog /var/log/httpd/access_log
rewriteengine on
proxyrequests off
usecanonicalname off
rewriterule ^/(.*)$ http://192.168.11.2/$1 [P,L]
servername download.yourdomain.com
errorlog /var/log/httpd/download/error_log
transferlog /var/log/httpd/download/access_log
rewriteengine on
proxyrequests off
usecanonicalname off
rewriterule ^/(.*)$ http://192.168.11.2/$1 [P,L]
×¢£ºÉeÖÃÀ»ðǽÉϵÄDNS£¬ÈÃdownload.yourdomain.comwww.yourdomain.com¶¼Ö¸Ïo
À»ðǽµÄÍa²¿Íø¿¨µØÖ¡£www.yourdomain.comÀÎÊÄaµÄ¹«Ë¾Ö÷Ò³£¬ ÓÃ
http://download.yourdomain.com/pub/...«¹²ÎļþÏÂÔØÇø¡?/a>
ÄaÐeÒªÔÚÄÚ²¿Íø¶ÎµÄapacheÖ÷»uÉϽ¨Á¢Ä¿Â¼/var/log/httpd/download/Ŀ¼£¬ñÔo»a
³o´i¡£ÁiÍa£¬ÄaÒ²¿ÉÒÔÉeÖÃÀ»ðǽÖ÷»uÉϵÄ/home/httpd/html/index.htmlµÄÊoÐÔΪ
750