Windows下編譯nginx-rtmp-module

來源:互聯網
上載者:User

標籤:http   svc   uwsgi   org   aio   依次   基礎   mercurial   -o   

http://nginx.org/en/docs/howto_build_on_win32.html

官網上的操作說明。

官網的方法Nginx編譯方法,思路是一致的,只是有幾個細節地方需要調整。

需要注意以下問題:

  1. Win10 作業系統下,貌似在編譯OpenSSL的時候有問題。
  2. 使用sm for Windows 作為微軟的masm 的替代。

 

一:下載以下工具,並依次安裝。

1、  下載 VS2010 + VS2010 SP1 (C++編譯環境)VS2015也可以。

2、  MSYS-1.0.11.exe

3、  ActivePerl-5.24.2.2403-MSWin32-x64-403863.exe

4、  mercurial-4.3.1-x64.msi

5、  nasm-2.12.02rc9-installer-x64.exe

6、  sed-4.2.1-setup.exe

7、  下載配套的所需庫代碼PCRE, zlib and OpenSSL libraries sources.

並且需要確保以上工具加入到了環境變數。

二、擷取Nginx原始碼

         開啟CMD命令,切換到Mercurial安裝根目錄,執行命令:

    hg clone http://hg.nginx.org/nginx

 

         下載成功後會在Mercurial安裝目錄下,建立nginx原始碼檔案夾。

 

 

 

三、添加依賴資源套件

         在nginx原始碼分別建立objs\lib 檔案夾,此處如此命名只是約定的習慣,可以不是這兩個名稱。並且將下載好的nginx-rtmp-module-master、openssl、pcre、zlib分別解壓在lib檔案夾下面。

         以上動作可以按官網教程一樣,使用MSYS使用CUI的方式。

 

結果如:

 

 

四、產生makefile檔案,用於C++編譯器

         繼續使用MSYS工具,返回到nginx原始碼根目錄,執行以下指令碼:

auto/configure --with-cc=cl --builddir=objs --prefix= \

--conf-path=conf/nginx.conf --pid-path=logs/nginx.pid \

--http-log-path=logs/access.log --error-log-path=logs/error.log \

--sbin-path=nginx.exe --http-client-body-temp-path=temp/client_body_temp \

--http-proxy-temp-path=temp/proxy_temp \

--http-fastcgi-temp-path=temp/fastcgi_temp \

--http-scgi-temp-path=temp/scgi_temp \

--http-uwsgi-temp-path=temp/uwsgi_temp \

--with-cc-opt=-DFD_SETSIZE=1024 --with-pcre=objs/lib/pcre-8.41 \

--with-zlib=objs/lib/zlib-1.2.11 --with-openssl=objs/lib/openssl-1.0.2k \

--with-select_module --with-http_ssl_module --add-module=objs/lib/nginx-rtmp-module

 

         有如上三部分輸出

 

 

         最終結果,會在objs目錄下產生Makefile檔案,以及其他所依賴的代碼。

五、OpenSSL的坑,

       需要修改 nginx\auto\lib\openssl\makefile.msvc 檔案。

      將ms\do_ms 改為ms\do_nasm。

具體原因參看篇文章。

       http://blog.csdn.net/felixking/article/details/51981794?utm_source=itdadao&utm_medium=referral

 

 

 

六、編譯Nginx源碼

         使用VS2010命令工具,切換到Nginx根目錄,執行nmake  -f objs/Makefile  命令。

 

 

【我一開始在Wi10上使用VS2015的開發人員工具,結果依然有問題,具體原因沒有分析出來,核心錯誤如下:

perl util/copy.pl "inc32\openssl\*.[ch]" "D:\Program Files\Mercurial\nginx\objs\lib\openssl-1.0.2k\openssl\include\openssl"

Destination must be a directory at util/copy.pl line 39.

推測是Win10版本都有這個異常】

 

    最後改為Win7+VS2010。

不算漫長的等待之後,激動人心的時刻就到來了。編譯成功。

 

 

七、建立運行基礎檔案夾

         在nginx.exe所在檔案夾下建立建立conf,logs,temp,tmp目錄,可將nginx-rtmp-module\test下的nginx.conf檔案複製到conf目錄下,啟動nginx,基礎的RTMP流媒體服務搭建完成。

 

 

Windows下編譯nginx-rtmp-module

相關文章

聯繫我們

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