August 05, 2010

IIS 上跑 mimeTeX 的 CGI 程式

突然來個要在 IIS 上跑 mimeTeX 這個 cgi 的需求
不然就是要架一個 apache... = =

找資料先...

WWW FAQs: How do I run CGI programs on IIS?
2006-06-26: Most web developers who choose Microsoft's Internet Information Server do their dynamic web design in ASP, ASP.NET or C#.NET, Microsoft's homegrown technologies for creating web applications. But you can run CGI programs on IIS. You simply have to configure IIS correctly.

(中略)

Adding Support For Python, Perl, and .EXE CGI Programs

Sure this is what you want? OK, enough talk - let's do it!
Before you do this, make sure you have no .py.plor .exe files anywhere in your web space that you wouldn't want your server to actually run. Always practice safe CGI!

Working at the server, do the following:

1. To support Python scripts, install the Python interpreter. Fetch and run the latest Windows Python installer from the official Python download page.

2. To support Perl scripts, install the Perl interpreter. Fetch and run the latest ActivePerl (Perl for Windows) installer from the official ActivePerl download page.

3. All done with both installs? Great! Configuration for Perl CGI programs (with a .pl extension) should be completely finished at this point. The rest of tutorial assumes you also want to support compiled.exe CGI programs and interpreted Python .py CGI scripts. To enable these, Locate the IIS control panel:
Start -> Control Panel -> Administrative Tools -> Internet Information Services
These steps are correct for the Windows XP "Classic View." If you are using the standard view, the steps are slightly different:Start -> Control Panel -> Performance and Maintenance -> Administrative Tools -> Internet Information Services
We recommend the "Classic View" for those who are running websites on their PCs.
4. Double-click your computer's name in the left-hand area, then double-click "Websites," then right-click your website's name or "Default Website."

5. A menu appears. Select "Properties."

6. Select the "Home Directory" tab.

7. From the "Execute Permissions:" menu, select "Scripts and Executables" to allow compiled .exe CGI programs (if desired) as well as Python and Perl CGI scripts.

8. If you want to run Python-based CGI programs, see Microsoft Knowledge Base article #276494,Using Python Scripts with IIS.

You should now be ready to roll with Perl CGI scripts, Python CGI scripts, and compiled executable CGI programs under Internet Information Server. Just remember that scripts "imported" from the Unix/Linux world will usually need some modifications, especially if they assume that Unix programs like sendmail are installed. In many cases, it's better to start over and do it the Windows way... or set up a Linux server!
--------------分隔線----------------
補充:
MS TechNET:啟用及停用 IIS 6.0 中的動態內容

除了上面的設定外,

要在 IIS 管理員中的 [網頁服務延伸] 內,
由「新增網頁服務延伸」加入 mimetex.cgi 並允許執行,
或是設定已存在的 [所有未知的 CGI 擴充程式] 允許執行,
CGI 才會執行。


延伸參考:
在 IIS 7.0 中設定 CGI 設定

--------------分隔線----------------

主題:在 iis 使用 cgi 教學 - kwanyik, 2005/2/4
來源

僅適用於 Windows XP Professional 及 Windows Server 2003
1. 在〔控制台〕→〔新增或移除程式〕→〔新增/移除Windows元件〕
選〔Internet Information Services (IIS)〕
*如果是 Windows Server 2003 先選
〔Application Server〕再選〔Internet Information Services (IIS)〕

2. 再在〔Internet Information Services (IIS)〕點選〔詳細資料〕
除預選項目確定已選〔World Wide Web Service〕內的〔World Wide Web Service〕
安裝後便在 C 盤出現 C:\Inetpub\wwwroot 這個目錄

3. 先下載及安裝 ActivePerl 5.6.1 build 635 8.6MB

6. 用〔檔案總管〕按下列程序將〔wwwroot〕目錄調整
鼠標右點〔資料夾〕→〔共用和安全性〕在〔Web 共用〕選〔共用這個資料夾〕
如果是使用 NTFS 格式者同時在上列三個資料夾的〔共用和安全性〕→〔安全性〕
在〔群組或使用者名稱〕按〔新增〕及加入〔IUSR_XXXXX〕
*XXXXXX 代表本機的電腦名稱

7. 在〔開始〕→〔所有程式〕→〔系統管理工具〕下選〔Internet Information Services〕

8. 打開〔網站〕→右點〔預設網站〕選內容
a. 在〔網站〕→〔位址〕上填上〔你的 IP〕,〔TCP 連接埠〕為〔80〕
b. 在〔主目錄〕→〔本機路徑〕上選〔C:\Inetpub\wwwroot〕另點選
〔指令碼來源存取〕、〔讀取〕及〔寫入〕
在〔應用程式設定〕→〔使用權限〕選〔指令碼及執行檔〕
再在〔應用程式設定〕→〔設定〕選〔新增〕
在〔執行檔〕一欄上填上〔C:\Perl\bin\perl.exe "%s" %s〕
在〔副檔名〕一欄上填〔.cgi〕
在〔限制於〕一欄上填〔GET,HEAD,POST〕
另點選〔指令碼引擎〕及〔檢查該檔案是否存在〕
c. 在〔目錄安全設定〕→〔匿名存取及驗證控制〕選〔編輯〕
點選〔匿名存取〕及在〔使用者名稱〕上選〔IUSR_XXXXX〕
*XXXXXX 代表本機的電腦名稱

9. 打開〔網站〕→〔預設網站〕→〔新增〕選〔虛擬目錄〕
在精靈選〔下一步〕在〔別名〕上填上〔cgi-bin〕按〔下一步〕
在〔目錄〕上選〔C:\Inetpub\wwwroot\cgi-bin〕按〔下一步〕
點選〔讀取〕、〔執行 (CGI)〕及〔寫入〕按〔下一步〕→〔完成〕

10. 右點〔cgi-bin〕選內容
a. 在〔虛擬目錄〕→〔本機路徑〕上選〔C:\Inetpub\wwwroot\cgi-bin〕另點選
〔指令碼來源存取〕、〔讀取〕及〔寫入〕
b.在〔應用程式設定〕→〔使用權限〕選〔指令碼及執行檔〕
再在〔應用程式設定〕→〔應用程式名稱〕如果不是〔cgi-bin〕者按〔移除〕及重建便會出現
再在〔應用程式設定〕→〔設定〕檢查〔.cgi〕副檔名是否存在
如果沒有按上〔8.b.〕辦法加回 c. 在〔目錄安全設定〕→〔匿名存取及驗證控制〕選〔編輯〕
點選〔匿名存取〕及在〔使用者名稱〕上選〔IUSR_XXXXX〕
*XXXXXX 代表本機的電腦名稱

11. 右點〔non-cgi〕資料夾選內容
a. 在〔虛擬目錄〕→〔本機路徑〕上選〔C:\Inetpub\wwwroot\non-cgi〕另點選
〔指令碼來源存取〕、〔讀取〕及〔寫入〕
b.在〔應用程式設定〕→〔使用權限〕選〔指令碼及執行檔〕
再在〔應用程式設定〕→〔應用程式名稱〕如果不是〔non-cgi〕者按〔移除〕及重建便會出現
再在〔應用程式設定〕→〔設定〕檢查〔.cgi〕副檔名是否存在
如果沒有按上〔8.b.〕辦法加回 c. 在〔目錄安全設定〕→〔匿名存取及驗證控制〕選〔編輯〕
點選〔匿名存取〕及在〔使用者名稱〕上選〔IUSR_XXXXX〕
*XXXXXX 代表本機的電腦名稱

12. 在〔網站〕→右點〔預設網站〕選〔啟動〕便完成
如果使用 Windows Server 2003 便要在〔網際網路資訊服務 (IIS) 管理員〕
→〔本機電腦〕→〔網頁服務延伸〕在〔所有未知的 CGI 擴充程式〕選〔允許〕

註:路徑只是預設的,如果你不是的話自己改
如我的perl在d:內,那〔C:\Perl\bin\perl.exe "%s" %s〕便要改為〔D:\Perl\bin\perl.exe "%s" %s〕……

--------------分隔線----------------

另一個好像比較完整的版本
來源






落落長...
-------------------分隔線----------------
mimeTeX 部分

mimeTeX quick start
mimeTeX 快速開始

mimeTex Manual
在 IIa Download and Compile 提到
可以在 windows 下編譯為 exe
並且在命令列執行進行測試

mimetex.cgi for windows 伺服器端腳本程序下載
下載下來的 mimetex.cgi 改名為 mimetex.exe
就可以在 windows 命令列執行

1 意見:

Elena Lily said...

Thank you for your post. This is useful information. Here we provide our special ones. Contentverse, Computhink India, Records Management System, Document Management Software, and much more.