编译nginx

为啥要编译,希望编译些模块
Ubuntu 20.04 LTS集成的版本nginx version: nginx/1.18.0 (Ubuntu)

wget 'http://nginx.org/download/nginx-1.18.0.tar.gz'
tar -xzvf nginx-1.18.0.tar.gz

wget 'https://github.com/winshining/nginx-http-flv-module/archive/v1.2.8.tar.gz'
tar -xzvf v1.2.8.tar.gz

cd nginx-1.18.0
./configure --add-module=/home/user/nginx/nginx-http-flv-module-1.2.8

提示:error: the HTTP rewrite module requires the PCRE library
sudo apt-get install libpcre3-dev
配置成功,默认位置,可以通过--prefix=/usr/local/nginx配置

  nginx path prefix: "/usr/local/nginx"
  nginx binary file: "/usr/local/nginx/sbin/nginx"
  nginx modules path: "/usr/local/nginx/modules"
  nginx configuration prefix: "/usr/local/nginx/conf"
  nginx configuration file: "/usr/local/nginx/conf/nginx.conf"
  nginx pid file: "/usr/local/nginx/logs/nginx.pid"
  nginx error log file: "/usr/local/nginx/logs/error.log"
  nginx http access log file: "/usr/local/nginx/logs/access.log"
  nginx http client request body temporary files: "client_body_temp"
  nginx http proxy temporary files: "proxy_temp"
  nginx http fastcgi temporary files: "fastcgi_temp"
  nginx http uwsgi temporary files: "uwsgi_temp"
  nginx http scgi temporary files: "scgi_temp"

wget 'https://github.com/openresty/headers-more-nginx-module/archive/v0.33.tar.gz'
tar -xzvf v0.33.tar.gz

rm -rf Makefile objs

./configure --prefix=/opt/nginx --add-module=../nginx-http-flv-module-1.2.8 --add-module=../headers-more-nginx-module-0.33
make
sudo make install

参考资料:

rtmp {
    server {
        listen 1985;
        application live {  
            live on;
        }
    }
}

http {
    server {
        listen       8080;
        location /live {
            flv_live on;
            chunked_transfer_encoding  on; #open 'Transfer-Encoding: chunked' response
            add_header 'Access-Control-Allow-Credentials' 'true'; #add additional HTTP header
            add_header 'Access-Control-Allow-Origin' '*'; #add additional HTTP header
            add_header Access-Control-Allow-Headers X-Requested-With;
            add_header Access-Control-Allow-Methods GET,POST,OPTIONS;
            add_header 'Cache-Control' 'no-cache';
        }
    }
}

标签: none

添加新评论