ÓÃApache·´Ïò´úÀíÉèÖöÔÍâµÄWWWºÍÎļþ·þÎñÆ÷

5年以前  |  阅读数:766 次  |  编程语言:PHP 

¼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

1.2.3.4ÊÇÀ»ðǽÍa²¿Íø¿¨µÄ»¥ÁªÍøÉÏÓÀ¾ÃIPµØÖ

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

 相关文章:
PHP分页显示制作详细讲解
SSH 登录失败:Host key verification failed
获取IMSI
将二进制数据转为16进制以便显示
获取IMEI
文件下载
贪吃蛇
双位运算符
PHP自定义函数获取搜索引擎来源关键字的方法
Java生成UUID
发送邮件
年的日历图
提取后缀名
在Zeus Web Server中安装PHP语言支持
让你成为最历害的git提交人
Yii2汉字转拼音类的实例代码
再谈PHP中单双引号的区别详解
指定应用ID以获取对应的应用名称
Python 2与Python 3版本和编码的对比
php封装的page分页类完整实例