需求: 搭建web服務器, 生成二維碼下載app, 綁定域名, 與tomcat集成。
系統環境: OS: windows server 2012 standard X64 2G
1.安裝IIS8.0 Web服務器
windows7用遠程桌面連接連接服務器, 進入"服務器管理器", 查看"儀表板"。(因爲安裝好的IIS,所以有IIS)
在右上角點擊"管理" -> "添加角色和功能" -> "基於角色或功能的安裝" -> "從服務器池中選擇服務器" -> 選擇Web服務器, 選擇功能點
勾選.NET Framework 3.5, 之後進行安裝一直到最後
安裝完成後回到儀表板, 點擊"工具" -> "IIS" 進入IIS
就表明IIS安裝好了。輸入localhost就可以看到IIS8.0的頁面了,用其他電腦輸入服務器的IP也可以看到IIS8.0的廣告了。
2.使用自己的網頁
新建的都有一個默認網站, Default Web Site, 將你的html文件放到服務器上,例如D:\jack, 單擊Default Web Site,然後在右側有一個基本設置,將物理路徑指向D:\jack,那麼輸入服務器IP就會訪問D:\jack\index.html了,還可以添加虛擬路徑, 新建網站等等。
3.綁定域名
首先在默認網站下設定自己購買的域名, 點擊綁定,填寫域名
然後去域名控制面板將其解析到服務器IP上,然後24小時內再輸入你的域名就可以看到你自己的網頁文件了。
4.IIS8.0 和 tomcat集成
大致如下:
1).安裝和配置AJP Connector
2).添加ISAPI 過濾
3).添加虛擬路徑
4).用戶認證
5).註冊ISAPI擴展程序
6).允許雙重轉義
step 1).安裝和配置AJP Connector
下載好ISAPI文件存放在C:\tomcat_iis_connector目錄下,如下圖所示。(其實可以隨意放在,不過下載的配置文件默認是放在這裏)
進去各個文件看一下大概知道什麼意思,修改conf\workers.properties.minimal,增加一行tomcat的位置。
step 2).添加ISAPI 過濾 (ISAPI Filters)
ISAPI篩選器
ISAPI篩選器是在啓用 ISAPI 的 HTTP服務器上運行的 DLL,用以篩選與服務器之間來回傳送的數據。該篩選器註冊事件的通知,例如登錄或 URL 映射。當發生選定事件時,篩選器被調用,並且您可以監視及更改數據(在數據從服務器傳輸到客戶端或相反的過程中)。可以使用
ISAPI篩選器提供增強的 HTTP 請求記錄(例如,跟蹤登錄到服務器的用戶)、自定義加密、自定義壓縮或其他身份驗證方法。
雙擊進入填好指向路徑
step 3).添加虛擬路徑
什麼叫虛擬路徑,知道linux的人都知道,linux是可以掛載的,這個虛擬路徑也是這個道理,類似於指針,指向真實的物理路徑。
完了後回到面板,點擊處理程序映射
回到面板,選擇請求篩選,右側的編輯功能設置,允許雙重轉義即可。
補充: 1.IIS 設置文件可下載
選擇到你的站點。單擊右鍵。選擇“屬性(Properties)”
“HTTP頭(HTTPHeaders)”選項卡 -> “MIME類型(MIMETypes)”
“新建(NEW)", 輸入擴展名.apk 類型(MIME) application/vnd.android
完成!
補充:2.IIS過濾請求獲得相應的頁面
在集成Tomcat後,網站下默認的index.html不會被訪問而是直接跑到Tomcat裏面去拿數據了,再來認識一下本質,IIS-Tomcat只是一個過濾轉發工具,配置文件可以規定轉發規則, 這個時候需要編輯uriworkermap.properties,設定
/.jsp=work1, 可以去看看官方解釋.
這樣一來除非是JSP,就不會去Tomcat裏面拿數據了。
- The IIS-Tomcat redirector is an IIS plugin (filter + extension), IIS load the redirector plugin and calls its filter function for each in-coming request.
- The filter then tests the request URL against a list of URI-paths held inside uriworkermap.properties, If the current request matches one of the entries in the list of URI-paths, the filter transfer the request to the extension.
- The extension collects the request parameters and forwards them to the appropriate worker using the defined protocol like ajp13 .
- The extension collects the response from the worker and returns it to the browser.
|
IIS-Tomcat 重定向是一個IIS插件,IIS加載後過濾每一個請求,如果在uriworkermap.properties有匹配到其中之一就會將請求傳給IIS
那麼針對PHP,JSP,.NET 這些如何整合呢?
Defining workers is done in workers.properties, this file includes two types of entries:
An entry that lists all the workers defined
worker.list=worker1, worker2
Entries that define the host and port associated with these workers
worker.worker1.host=localhost
worker.worker1.port=8009
worker.worker1.type=ajp13
worker.worker2.host=otherhost
worker.worker2.port=8009
worker.worker2.type=ajp13
|
The above example defined two workers, now we can use these workers to serve two different contexts each with its own worker :
example uriworkermap.properties fragment
/examples/*=worker1
/webpages/*=worker2
|
As you can see the examples context is served by worker1 while
the webpages context is served by worker2 .
|
2.接下來需要完成解決如下問題
問題: 1.Tomcat 和 Apache到底是什麼?
2.DNS到底是什麼?域名綁定的原理
3.郵件服務器
I'm fish, I'm on.