linux 上安裝tomcat、進行相關設定、處理部分部署問題__linux

來源:互聯網
上載者:User

   tomcat安裝沒啥說的,去apache tomcat官網下載需要tomcat對應版本zip,上傳至linux服務相關檔案夾下,執行unzip -d tomcat 解壓,然後進行以下配置

1.設定執行許可權,新上傳的tomcat檔案均沒有執行許可權,為bin檔案夾下的.sh統一加上執行許可權
   cd bin
   chmod +x *.sh  或者簡單粗暴的執行 chmod 777 -R bin  (-R代表遞迴授權)
   
2.啟動伺服器指令碼(startuo.sh)會有以下錯誤提示:
    The BASEDIR environment variable is not defined
    This environment variable is needed to run this program
  解決辦法:
    在startup.sh和catalina.sh兩個檔案中分別加入以下內容:
      startup.sh:BASEDIR=/usr/local/tomcat/
      catalina.sh:CATALINA_HOME=/usr/local/tomcat/
      
3.啟動tomcat
   sh startup.sh
   如果部署項目想要不使用項目名訪問,有兩種方法:
     1.直接在tomcat的webapps目錄下 放入項目,但是項目的名稱要改為ROOT
     2.在server.xml檔案中配置下面的host
        <Host name="www.project.com" appBase="webapps" autoDeploy="true" debug="0" unpackWARs="true">
            <Context crossContext="true" debug="0" docBase="/project/WebContent" path="" reloadable="false"/>     
        </Host>

4.項目在Windows上開發,linux上部署,windows本地表單和url參數傳遞沒有中文亂碼現象,伺服器上卻有
   原因:tomcat編碼問題;預設的是ISO8859-1
   修改tomcat的conf目錄下的server.xml檔案中配置URIEncoding
   <Connector port="8080" protocol="HTTP/1.1" connectionTimeout="20000" redirectPort="8443" URIEncoding="UTF-8" />  
   

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在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.