嗯,很多服务在这里一起工作,但实际上并不复杂。
我有一个运行nginx + nginx-vod-module的ec2,我们使用s3存储桶作为媒体源。直接访问ec2实例访问媒体工作正常。在EC2前面添加ELB后,我得到504错误。
我认为问题必须使用vod_upstream_location
和X-Forwarded-For header
组合做一些事情,但我不确定。
vod.conf
server {
listen 80;
server_name _;
access_log off;
error_log /opt/nginx/logs/vod_error.log;
open_file_cache max=1000 inactive=5m;
open_file_cache_valid 2m;
open_file_cache_min_uses 1;
open_file_cache_errors on;
vod_upstream_location /s3;
vod_mode remote;
vod_metadata_cache metadata_cache 256m;
vod_response_cache response_cache 256m;
location /s3/ {
internal;
proxy_pass http://s3bucket-url.amazonaws.com/;
}
location /hls/ {
vod hls;
gzip on;
gzip_types application/x-mpegURL;
add_header Access-Control-Allow-Origin "*";
}
location /hds/ {
vod hds;
vod_segment_duration 6000;
vod_align_segments_to_key_frames on;
vod_segment_count_policy last_rounded;
add_header Last-Modified "Sun, 19 Nov 2000 08:52:00 GMT";
add_header Access-Control-Allow-Origin "*";
expires 100d;
}
location /crossdomain.xml {
alias /opt/nginx/html/crossdomain.xml;
access_log off;
}
location /status/ {
vod_status;
}
}