2014年1月4日 星期六

Ubuntu 用 Binary 的方式安裝 Tomcat

1. Apache Tomcat官網下載 apache-tomcat-8.0.0-RC10-tar.gz

2. 解壓縮後放到 /opt/usr/local 或 家目錄下

3. 編輯 ~/.bashrc,加入:
        export TOMCAT_HOME=”[2 的路徑]”
        export PATH=”$PATH:$TOMCAT_HOME/bin”
        export CLASSPATH=”$TOMCAT_HOME/lib/jsp-api.jar:$TOMCAT_HOME/lib/servlet-api.jar:$CLASSPATH”
        ( 或是在 bin 中執行 setclasspath.sh )


4.cd tomcat_path/bin 下後輸入 ./startup.sh 即可啟動



其中 8080 Tomcat 預設的 port,可以自行修改,設定檔為 : /usr/local/tomcat6/conf/server.xml

5. ./shutdown.sh 就可以關閉

===============================================================

登入 Host Manager Manager App 需要輸入帳號密碼
但是預設沒有帳戶
所以要自行去修改 tomcat_path/conf/tomcat-users.xml
需要定義 <role> <user>
如果要以 admin 的身份登入管理介面
要這樣:
        <tomcat-users>
                <role rolename=”admin-gui” />
                <user username=”xxx” password=”yyy” roles=”admin-gui” />
        </tomcat-users>
然後存檔重新啟動 tomcat 即可生效
role:
admin-gui            allows access to the HTML GUI and the status pages
admin-script        allows access to the HTML GUI and the status pages
manager-gui        allows access to the HTML GUI and the status pages
manager-script    allows access to the text interface and the status pages
manager-jmx       allows access to the JMX proxy and the status pages 
manager-status    allows access to the status pages only

登入 Manage App 後的畫面:
這個畫面可以 delpoy 你的 Servlet JSP 網頁專案,也可以看到 Example 和其 Source Code
war Web Application ARchive (相較於 jar [Java Archive]),可以用此來包裝後佈署
directory 佈署至少要有 Context Path (.jsp .html)

tomcat_path/webapps 下有許多的目錄
這個 webapps 相當於 apache/www
建立一個 test 目錄,然後建立一個 Hello.jsp
將以下內容加入後存檔:

<html>
    <head>
       <title>
            Hello World
       </title>
    </head>
   <body>
       <% String s = "Veck"; %>
       <h1>Hello <%=s%></h1>
    </body>
</html>

然後在網址列輸入:localhost:8080/test/Hello.jsp









或者也可以用上面的 GUI,在 Context Path(required) 輸入:專案路徑
ex.     /opt/tomcat-8.0.0/webapps/test
然後按下 Deploy,頁面會重新整理後再表單多出了 /test,這樣就完成佈署了

只要按下 Undeploy就可以取消佈署,但同時也是將 webapps中的整個專案給移除

1 則留言:

  1. As a part of} the scientific molding course of, our molders independently optimize and monitor fill speed, hold pressure, and hold time, and periodically examine part high quality and cosmetics. Kids Caps During the molding course of, we use an automatic inline CMM to ensure dimensional accuracy, as well as|in addition to} generate an in depth course of functionality examine and FAI report. In quantity of} cavity moulds, each cavity may be identical and kind the same parts or may be unique and kind quantity of} completely different geometries throughout a single cycle. Moulds are usually made from tool steels, but stainless steels and aluminium moulds are suitable for sure purposes. Many metal moulds are designed to course of nicely over one million parts throughout their lifetime and can price hundreds of hundreds of dollars to fabricate.

    回覆刪除