Apache HTTP Server 使用指南 1 修改曆史
| 版本 |
修改曆史 |
作者 |
描述 |
開發時間(h) |
| 0.1 |
2007-8-7 |
LevinSoft |
建立文檔得基本結構、基本流程 |
1 |
| 0.2 |
2007-8-21 |
LevinSoft |
增加啟動方式 |
0.1 |
2 介紹 本文介紹Apache HTTP Server基本概念、代理功能配置步驟、操作注意事項和相關的參考資源。
3 基本概念 The Apache HTTP Server Project is an effort to develop and maintain an open-source HTTP server for modern operating systems including UNIX and Windows NT. The goal of this project is to provide a secure, efficient and extensible server that provides HTTP services in sync with the current HTTP standards. Apache has been the most popular web server on the Internet since April 1996. The November 2005 Netcraft Web Server Survey found that more than 70% of the web sites on the Internet are using Apache, thus making it more widely used than all other web servers combined. The Apache HTTP Server is a project of the Apache Software Foundation.
4 Apache HTTP Server代理功能配置 Apache HTTP Server具有IP代理的功能,這可以轉換外網IP可以訪問到內網IP。
4.1 安裝步驟和相關配置 4.1.1 安裝 在linux、unix下安裝。 #tar -vzxf httpd-2.0.50.tar.gz #cd httpd-2.0.50 #./configure --prefix=/usr/local/apache2 --enable-track-vars --enable-proxy --enable-cgi --enable-so --enable-mods-shared=all --with-config-file-path=/usr/local/apache2/conf #make #make install
4.2 配置步驟 這個以Window 2000為例,Linux的配置也類似。
4.2.1 設定apache動態Proxy 伺服器(Windows 2000) 假設apache安裝在C:/ApacheGroup/Apache2下 開啟conf目錄下的httpd.conf檔案 1)找到 #LoadModule proxy_module modules/mod_proxy.so #LoadModule proxy_connect_module modules/mod_proxy_connect.so #LoadModule proxy_http_module modules/mod_proxy_http.so #LoadModule proxy_ftp_module modules/mod_proxy_ftp.so 把#去掉使動態代理模組生效 2)在檔案的最後,添加如下配置選項 <VirtualHost 60.190.200.11:80> ServerAdmin wangzm@channelsoft.com DocumentRoot C:/ApacheGroup/Apache2/htdocs ServerName 60.190.200.11 ProxyRequests Off ProxyPass /test http://192.168.100.100:8080/test ProxyPassReverse /test http://192.168.100.100:8080/test ErrorLog logs/channelsoft.com-error_log CustomLog logs/channelsoft.com common </VirtualHost> 說明: 60.190.200.11代表動態Proxy 伺服器apache的地址 ProxyPass和ProxyPassReverse代表當使用者在瀏覽器中敲入test時跳轉到內網的 Web伺服器上.
4.2.2 設定內網web伺服器 以Resin 應用伺服器為例: 1. 開起內網web伺服器的防火牆。運行setup->防火牆配置->啟用 2. 修改resin.conf檔案配置 開啟resin應用伺服器的resin.conf檔案, 找到: <http port='8080'/> 修改為:<http host=’內網IP地址’ port='8080'/> 找到: <srun host='127.0.0.1' port='6803'/> 修改為: <srun host='內網IP地址' port='6803'/>
4.2.3 啟動服務 1./usr/local/apache2/bin/./ apachectl stop, start, restart 2.ps -ef|grep apache2 查看運行情況
4.2.4 檢測配置是否生效 重新啟動apacheProxy 伺服器和內網web伺服器即可. 通過http:// 60.190.200.11/test( 動態Proxy 伺服器)即可訪問http://192.168.100.100:8080/test(內網web伺服器)的內容。
4.3 常見問題集和注意事項 1.Apache http server在unix,linux,windows有不同的版本。 2.一台主機上,允許有兩個網卡,可以配置內網和外網ip。例如:外網IP是:60.190.247.11;內網ip地址是:192.168.1.11為,連接埠號碼是:8080, 3.配置時,一定要設定帶proxy的so檔案。 4.可以在設定檔中的virtualhost標籤內部,設定迴圈代理的操作,就是有一個代理路徑調轉到,另外的一個新的proxy伺服器。 5.Apache http server當前只能代理http,不能代理ftp。
4.4 配置執行個體 <VirtualHost 134.96.71.120:80> ServerAdmin wangzm@channelsoft.com DocumentRoot /usr/local/apache2/htdocs ServerName 134.96.71.120 ProxyRequests Off ProxyPass /test http://134.96.71.27:8080/boss ProxyPassReverse /test http://134.96.71.27:8080/boss ProxyPass /vpm http://134.96.71.28/vpm ProxyPassReverse /vpm http://134.96.71.28/vpm ErrorLog logs/test_error.log CustomLog logs/test.log commom </VirtualHost>
5 總結和展望 a) 簡單的總結前面知識 b) 今後的提高部分
6 參考資料 1. http://httpd.apache.org/ 2.
7 術語和附錄