有没有办法在nginx上启用这个模块? http://wiki.nginx.org/HttpMp4Module
我已经有很多在nginx上运行的域名,我不能删除它并重build所有的东西。
我尝试下载最新的nginx,并做./configure --with-http_mp4_module ,然后make install但它没有奏效。 此外,我恐怕这个重新编译过程将删除所有我的conf和域设置。
首先,备份你的nginxconfiguration文件夹(/ etc / nginx) – 如果你的configuration对你有价值,那么你肯定需要一个额外的副本,以防万一出现问题。 也就是说,大多数安装不会覆盖现有的configuration。
其次,对于一个合适的configuration行,运行nginx -V (和你的工作nginx),然后添加额外的configuration语句,可能有其他configuration参数与您的设置相关。 (这也可以让你validation这个模块是否已经编译成你正在运行的版本。)(另外,你说这是行不通的 – 为什么?错误是什么?)。 默认的nginxconfiguration语句(x86)是:
--prefix=/etc/nginx/ --sbin-path=/usr/sbin/nginx --conf-path=/etc/nginx/nginx.conf --error-log-path=/var/log/nginx/error.log --http-log-path=/var/log/nginx/access.log --pid-path=/var/run/nginx.pid --lock-path=/var/run/nginx.lock --http-client-body-temp-path=/var/cache/nginx/client_temp --http-proxy-temp-path=/var/cache/nginx/proxy_temp --http-fastcgi-temp-path=/var/cache/nginx/fastcgi_temp --http-uwsgi-temp-path=/var/cache/nginx/uwsgi_temp --http-scgi-temp-path=/var/cache/nginx/scgi_temp --user=nginx --group=nginx --with-http_ssl_module --with-http_realip_module --with-http_addition_module --with-http_sub_module --with-http_dav_module --with-http_flv_module --with-http_mp4_module --with-http_gzip_static_module --with-http_random_index_module --with-http_secure_link_module --with-http_stub_status_module --with-mail --with-mail_ssl_module --with-file-aio --with-ipv6 --with-cc-opt='-O2 -g -march=i386 -mtune=i686'
最后,如果你没有特定的优化(例如,你已经删除了特定的模块等),你可以使用nginx资源库 (可用于RHEL / CentOS,Debian / Ubuntu) – 发布的二进制文件包括你正在寻找的模块(根据上面的configuration语句)和存储库使其更容易维护(缺点是缺less定制,但有时候,这是一个值得付出的代价)。
存储库版本不会覆盖你的configuration,但是如果有新的configuration文件,它会添加它们 – 这是新版本configuration的一个问题,因为/etc/nginx/conf.d/default.conf被添加 – 它指定了一个可能与现有configuration不兼容的附加服务器。 (你可以重命名这个文件,甚至复制你的整个/ etc / nginx文件夹来恢复你的旧configuration)
安装:
$ sudo apt-get install nginx-extras
configuration示例:
location /video/ { mp4; mp4_buffer_size 1m; mp4_max_buffer_size 5m; mp4_limit_rate on; mp4_limit_rate_after 30s; }