Apache+tomcat使用mod_proxy做動靜態分離

來源:互聯網
上載者:User

標籤:動靜態分離

1、配置 apache 的設定檔 ,修改 apache 的主設定檔 http.conf  使其支援 vhost 虛擬機器主機vim /usr/local/apache2/conf/httpd.confInclude conf/extra/httpd-vhosts.conf  # 去掉改行的注釋2、編輯 /usr/local/apache2/conf/extra/httpd-vhosts.conf  配置 apache 的虛擬機器主機vim /usr/local/apache2/conf/extra/httpd-vhosts.conf---------------------------------------------------NameVirtualHost *:80    # 指定伺服器監聽的連接埠 <VirtualHost *:80>  # 虛擬機器主機的代碼快    ServerAdmin [email protected]   # 管理員連絡方式    DocumentRoot "/usr/local/tomcat/webapps/ROOT"  #指定 apache 的網頁目錄    ServerName    www.wanqiu.com       # 指定用戶端訪問的網域名稱    ServerAlias  wanqiu.com               # 指定用戶端訪問網域名稱的別名    ErrorLog "logs/www.wanqiu.com-error.log"  #  指定 apache 錯誤記錄檔的路徑    CustomLog "logs/www.wanqiu.com-access_log" common  # 指定 apache 訪問日誌路徑    ProxyRequests Off     # 代理轉寄請求    ProxyPreserveHost On  # 啟動代理轉寄某台電腦    ProxyPass /*.jpg !      # 靜態 jpg 圖片不代理    ProxyPass /*.gif !       # 靜態 jif 圖片不代理    ProxyPass /*.png !      # 靜態 png圖片不代理    ProxyPass /*.js !        # 靜態 js圖片不代理    ProxyPass /*.html !      # 靜態頁面 html 頁面不代理    ProxyPass /test.html !    # 靜態頁面 test.html 頁面不代理    ProxyPass / http://172.16.123.111:8080/  # 指定被代理的地址和連接埠    ProxyPassReverse / http://172.16.123.111:8080/  # 指定反向 Proxy    <Directory "/usr/local/tomcat/webapps/ROOT">  #  授權 apache 訪問的目錄    Options –Indexes   # 允許列出index 檔案    AllowOverride None # 確定允許存在於.htaccess檔案中的指令類型    Order allow,deny    # 允許未明確拒絕的    Allow from all       # 允許所有的訪問   </Directory></VirtualHost>--------------------------------------------------------------------------------

本文出自 “光普-IT公社” 部落格,請務必保留此出處http://guangpu.blog.51cto.com/3002132/1567282

Apache+tomcat使用mod_proxy做動靜態分離

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.