共用電腦上的媒體資源給ipad、iphone、android等行動裝置的方法

來源:互聯網
上載者:User

  現在生活改變了,大家手上都有ipad、iphone、android這些東西了

  我相信很多菜鳥肯定要問如何共用電腦上的媒體資源呢?

 

  我目前使用的方法:

1、使用Ftp伺服器

 然後android這些都有FTP用戶端。

windows 做伺服器可以用Serv-U FTP Server或者免費的FileZilla Server。

2、使用HTTP伺服器

比如最簡單的HFS

官方:http://www.rejetto.com/hfs/?f=dl

我今天重點介紹使用apache tomcat 建立網站共用電腦上的媒體。

我們需要安裝的東西有:JDK還有apache tomcat

JDK :www.oracle.com/technetwork/java/javase/downloads/index.html

tomcat:

7.0

http://tomcat.apache.org/download-70.cgi

6.0

http://tomcat.apache.org/download-60.cgi

下載要注意:JDK和tomcat 要配套

JDK7 用tomcat 7

32位windows系統要用x86

64位windows系統要用x64

apache-tomcat-7.0.16.tar 我下載的是這個

JDK是EXE 直接雙擊安裝就可以了,一路下一步就裝好了。

apache-tomcat-7.0.16.tar 直接用解壓縮工具比如winrar解壓縮就可以用了

啟動tomcat:雙擊

apache-tomcat-解壓縮目錄\bin\startup.bat

開啟firefox,輸入http://localhost:8080,如果正常訪問,則表示成功。

停止tomcat:雙擊

apache-tomcat-解壓縮目錄\bin\shutdown.bat

剩下的問題就是如何配置apache-tomcat

修改tomcat安裝目錄下的conf中server.xml.

將元素<Context path="/myweb" docBase=" E:\Downloads" />加入元素<host></host>中間.

具體含義是:

   <Context

     path="/myweb"         /必須要有,表示此虛擬目錄的名稱:http://localhost:8080/myweb

     docBase=" E:\Downloads" /> 虛擬目錄在硬碟上的絕對路徑

我貼出我修改的片斷:

<Host name="localhost"  appBase="webapps"            unpackWARs="true" autoDeploy="true">        <!-- SingleSignOn valve, share authentication between web applications             Documentation at: /docs/config/valve.html -->        <!--        <Valve className="org.apache.catalina.authenticator.SingleSignOn" />        -->        <!-- Access log processes all example.             Documentation at: /docs/config/valve.html             Note: The pattern used is equivalent to using pattern="common" -->        <Valve className="org.apache.catalina.valves.AccessLogValve" directory="logs"                 prefix="localhost_access_log." suffix=".txt"               pattern="%h %l %u %t "%r" %s %b" resolveHosts="false"/>        <Context path="/myweb" docBase="E:\Downloads" />      </Host>    </Engine>  </Service></Server>

那麼在IE地址欄輸入http://localhost:8080/myweb就會出現列表形式,就可以訪問了

實際上 這樣做只會提示404錯誤。。。OTL

這個主要是處於安全性的考慮。要是你的目錄下沒有預設首頁,那你的這個目錄下的檔案清單就泄露給別人了。

配置選項在TOMCAT/conf/web.xml中找到listings

將false改為true即可解決此問題

我貼出我修改的片斷:

  
<servlet>        <servlet-name>default</servlet-name>        <servlet-class>org.apache.catalina.servlets.DefaultServlet</servlet-class>        <init-param>            <param-name>debug</param-name>            <param-value>0</param-value>        </init-param>        <init-param>            <param-name>listings</param-name>            <param-value>true</param-value>        </init-param>        <load-on-startup>1</load-on-startup>    </servlet>

使用裝置是無法訪問http://localhost:8080/myweb

因為localhost是指本機。你必須替換為你網卡的Ip比如我的是

http://192.168.189.128:8080/myweb/

OK,該說的都說完了,更多tomcat 配置方法自己baidu 學習吧

如果你需要用IIS Express 7.5 代替tomcat

請閱讀http://blog.csdn.net/luozhuang/article/details/7645662

以及 配置IIS Express 7.5以允許外部存取

相關文章

聯繫我們

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