日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 运维知识 > windows >内容正文

windows

windows下编译nginx-http-flv-moudle

發布時間:2023/12/29 windows 27 豆豆
生活随笔 收集整理的這篇文章主要介紹了 windows下编译nginx-http-flv-moudle 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

windows下編譯nginx-http-flv-moudle

  • 一: 編譯前準備
    • 1:msys(1.0.11內含mingw命令行工具)
    • 2:perl (ActivePerl 5.28,草莓版好像會編譯出錯,具體原因不知)
    • 3:nasm(2.11.02)
    • 4:sed
    • 5:nginx-http-flv-moudle
    • 6:zlib(1.2.11,Zlib是一個壓縮和解壓模塊)
    • 7:openssl(1.1.1d,加密)
    • 8:pcre(8.3.4perl語言兼容正則表達式)
  • 二:開始編譯
    • 1:windows先安裝vs,若已安裝跳過。未安裝則請安裝vs2017社區版本,并配置相關環境變量。(vs編譯 nmake命令,安裝社區版vs2017,企業版不行,會出現nmake命令不可用),以下是本機配置的環境變量
    • 2:編譯
      • 2.1 新建文件夾nginx-flv并解壓nginx源碼到nginx-flv下
      • 2.2 在nginx-flv下新建文件夾build,進入build,在build下新建文件夾3rdlib和output
      • 2.3.將nginx-http-flv-module,openssl,zlib,pcre解壓縮到nginx-flv/build/3rdlib目錄下
      • 2.4.在nginx-flv目錄下新建build.bat文件并輸入以下腳本
      • 2.5 最終整個編譯工程的目錄構架如下
      • 2.6.打開mingw命令行工具進入nginx-flv目錄執行build.bat

一: 編譯前準備

1:msys(1.0.11內含mingw命令行工具)

2:perl (ActivePerl 5.28,草莓版好像會編譯出錯,具體原因不知)

3:nasm(2.11.02)

4:sed

安裝完之后,配置正確的環境變量。

5:nginx-http-flv-moudle

6:zlib(1.2.11,Zlib是一個壓縮和解壓模塊)

7:openssl(1.1.1d,加密)

8:pcre(8.3.4perl語言兼容正則表達式)

二:開始編譯

1:windows先安裝vs,若已安裝跳過。未安裝則請安裝vs2017社區版本,并配置相關環境變量。(vs編譯 nmake命令,安裝社區版vs2017,企業版不行,會出現nmake命令不可用),以下是本機配置的環境變量

添加vs環境變量(包含LIB INCLUDE),詳見教程
https://blog.csdn.net/kaige_zhao/article/details/80315697
例如:
path變量
D:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.14.26428\bin\HostX64\x64

LIB變量
D:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.16.27023\lib\x64;D:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.16.27023\lib\x64;D:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.16.27023\lib\x64

INCLUDE變量
D:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.16.27023\include;D:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.16.27023\include

2:編譯

2.1 新建文件夾nginx-flv并解壓nginx源碼到nginx-flv下

2.2 在nginx-flv下新建文件夾build,進入build,在build下新建文件夾3rdlib和output

2.3.將nginx-http-flv-module,openssl,zlib,pcre解壓縮到nginx-flv/build/3rdlib目錄下

2.4.在nginx-flv目錄下新建build.bat文件并輸入以下腳本

auto/configure --with-cc=cl --builddir=build/output --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-flv.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=build/3rdlib/pcre-8.34
–with-zlib=build/3rdlib/zlib-1.2.11 --with-openssl=build/3rdlib/openssl-1.0.1u

–with-select_module --with-http_ssl_module
–add-module=build/3rdlib/nginx-http-flv-module-master
(* 加粗部分為本地文件的路徑,如果版本與本文不一致記得修改)

2.5 最終整個編譯工程的目錄構架如下

nginx-flv
├─auto
├─build
│ ├─3rdlib
│ │ ├─nginx-http-flv-module-master
│ │ ├─openssl-1.0.1u
│ │ ├─pcre-8.34
│ │ └─zlib-1.2.11
│ └─output
├─conf
├─contrib
├─docs
├─misc
├─src
└─build.bat

2.6.打開mingw命令行工具進入nginx-flv目錄執行build.bat

cd F:/nginx-flv // 這里不是Windows風格的命令,必須使用F:/nginx-flv,而不能使用F:\nginx-flv

build.bat // 運行build.bat文件,這個挺耗時的,大約幾分鐘吧,結束后會在nginx-flv/build/output目錄下生成Makefile,運行結束如下圖

如執行nmake /f build/output/Makefile 報錯如下圖:

修改nginx\auto\lib\openssl\makefile.msvc文件:
將VC-WIN32改為VC-WIN64A,將ms\do_ms 改為ms\do_win64a

進入D:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build文件夾下,雙擊運行vcvarsall.bat文件。

切換openssl版本為1.1.1d,繼續執行nmake命令,報錯

解決辦法:
修改C:\Perl64\lib\ActivePerl\Config.pm,大約在400行左右,屏蔽sub_marn里面的代碼。

Vs本機命令提示符工具 到nginx-flv目錄下 執行nmake命令
執行成功。

到此,編譯完成。目錄下生成了 makefile文件和nginx.exe,雙擊nginx.exe可以啟動nginx,并將nginx原版的相關目錄拷貝過來,如下圖

最后本機的nginx.conf文件內容如下:

#user nobody; worker_processes 1;#error_log logs/error.log; #error_log logs/error.log notice; #error_log logs/error.log info;#pid logs/nginx.pid;events {worker_connections 1024; }http {include mime.types;#default_type application/octet-stream;#log_format main '$remote_addr - $remote_user [$time_local] "$request" '# '$status $body_bytes_sent "$http_referer" '# '"$http_user_agent" "$http_x_forwarded_for"';#access_log logs/access.log main;sendfile on;#tcp_nopush on;#keepalive_timeout 0;keepalive_timeout 65;#gzip on;server {listen 80;location / {root D:/javaTools/zzcc-visual-ui/zzcc-visual-ui/build;index index.html index.htm;try_files $uri $uri/ /index.html;add_header 'Access-Control-Allow-Origin' '*';}location /fcloud {root D:/ruihai/resources/local-cloud;add_header 'Access-Control-Allow-Origin' '*';}}server {listen 85;location /flv {flv_live on; #打開HTTP播放FLV直播流功能chunked_transfer_encoding on; #支持'Transfer-Encoding: chunked'方式回復add_header 'Access-Control-Allow-Origin' '*'; #添加額外的HTTP頭add_header 'Access-Control-Allow-Credentials' 'true'; #添加額外的HTTP頭}location /hls { types{ application/vnd.apple.mpegurl m3u8; video/mp2t ts; } alias /test; expires -1; }location /stat {rtmp_stat all;rtmp_stat_stylesheet stat.xsl;}location /stat.xsl {root html/nginx-http-flv-module/;}location /control {rtmp_control all;}location /rtmp-publisher {root html/nginx-http-flv-module/test;}#access_log logs/host.access.log main;#location / {#root html/nginx-http-flv-module/test/www;#index index.html index.htm;#}#error_page 404 /404.html;# redirect server error pages to the static page /50x.html#error_page 500 502 503 504 /50x.html;location = /50x.html {root html;}}}rtmp { server { listen 1935; chunk_size 4000; application hls { live on;record off;hls on;hls_path /test;hls_fragment 1s;} } }

創作不易,點個關注支持以下把!

總結

以上是生活随笔為你收集整理的windows下编译nginx-http-flv-moudle的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。