Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
E
envsetup
Manage
Activity
Members
Plan
Redmine
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Container Registry
Model registry
Analyze
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
mediaserver
envsetup
Commits
773b0736
Commit
773b0736
authored
8 years ago
by
Florent Thiery
Browse files
Options
Downloads
Patches
Plain Diff
optimize cache conf, fixes
#20420
parent
2ce5d4e6
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
2.Common_services/5.Nginx/vhost_cache.conf
+22
-19
22 additions, 19 deletions
2.Common_services/5.Nginx/vhost_cache.conf
2.Common_services/5.Nginx/vhost_mediaserver-msuser.conf
+10
-22
10 additions, 22 deletions
2.Common_services/5.Nginx/vhost_mediaserver-msuser.conf
with
32 additions
and
41 deletions
2.Common_services/5.Nginx/vhost_cache.conf
+
22
−
19
View file @
773b0736
...
@@ -23,19 +23,21 @@ server {
...
@@ -23,19 +23,21 @@ server {
proxy_cache_key
$
scheme
$
proxy_host
$
uri
;
proxy_cache_key
$
scheme
$
proxy_host
$
uri
;
# only one request at a time will be allowed to populate a new cache element
# only one request at a time will be allowed to populate a new cache element
proxy_cache_lock
on
;
proxy_cache_lock
on
;
proxy_cache_min_uses
1
;
# ignore upstream headers
proxy_cache_use_stale
updating
;
# http://nginx.org/en/docs/http/ngx_http_proxy_module.html#proxy_cache_valid
# how long should the data be kept in the cache
proxy_cache_valid
200
1
s
;
# instruct browser never to cache this
expires
-
1
;
# headers
proxy_ignore_headers
Cache
-
Control
;
proxy_ignore_headers
Cache
-
Control
;
proxy_ignore_headers
Set
-
Cookie
;
proxy_ignore_headers
X
-
Accel
-
Expires
;
proxy_ignore_headers
X
-
Accel
-
Expires
;
proxy_ignore_headers
Expires
;
proxy_ignore_headers
Expires
;
proxy_hide_header
Pragma
;
# hide upstream X-Cache header
proxy_hide_header
X
-
Cache
;
# add own X-Cache header
add_header
X
-
Cache
$
upstream_cache_status
;
add_header
X
-
Cache
$
upstream_cache_status
;
# m3u8-specific
# how long should the data be kept in this cache
proxy_cache_valid
200
2
s
;
# instruct browsers never to cache m3u8
expires
-
1
;
}
}
location
~ \.
ts
$ {
location
~ \.
ts
$ {
rewrite
^/(.*)$ /$
1
?
break
;
rewrite
^/(.*)$ /$
1
?
break
;
...
@@ -45,19 +47,21 @@ server {
...
@@ -45,19 +47,21 @@ server {
proxy_cache_key
$
scheme
$
proxy_host
$
uri
;
proxy_cache_key
$
scheme
$
proxy_host
$
uri
;
# only one request at a time will be allowed to populate a new cache element
# only one request at a time will be allowed to populate a new cache element
proxy_cache_lock
on
;
proxy_cache_lock
on
;
proxy_cache_min_uses
1
;
# ignore upstream headers
proxy_cache_use_stale
updating
;
# http://nginx.org/en/docs/http/ngx_http_proxy_module.html#proxy_cache_valid
# how long should the data be kept in the cache
proxy_cache_valid
200
10
s
;
# instruct browser to cache this
expires
2
s
;
# headers
proxy_ignore_headers
Cache
-
Control
;
proxy_ignore_headers
Cache
-
Control
;
proxy_ignore_headers
Set
-
Cookie
;
proxy_ignore_headers
X
-
Accel
-
Expires
;
proxy_ignore_headers
X
-
Accel
-
Expires
;
proxy_ignore_headers
Expires
;
proxy_ignore_headers
Expires
;
proxy_hide_header
Pragma
;
# hide upstream X-Cache header
proxy_hide_header
X
-
Cache
;
# add own X-Cache header
add_header
X
-
Cache
$
upstream_cache_status
;
add_header
X
-
Cache
$
upstream_cache_status
;
# ts-specific
# how long should the data be kept in this cache
proxy_cache_valid
200
10
s
;
# instruct browsers to cache this for 6s
expires
6
s
;
}
}
}
}
location
/
resources
/ {
location
/
resources
/ {
...
@@ -81,7 +85,6 @@ server {
...
@@ -81,7 +85,6 @@ server {
proxy_ignore_headers
Set
-
Cookie
;
proxy_ignore_headers
Set
-
Cookie
;
proxy_ignore_headers
X
-
Accel
-
Expires
;
proxy_ignore_headers
X
-
Accel
-
Expires
;
proxy_ignore_headers
Expires
;
proxy_ignore_headers
Expires
;
proxy_hide_header
Pragma
;
add_header
X
-
Cache
$
upstream_cache_status
;
add_header
X
-
Cache
$
upstream_cache_status
;
}
}
}
}
...
...
This diff is collapsed.
Click to expand it.
2.Common_services/5.Nginx/vhost_mediaserver-msuser.conf
+
10
−
22
View file @
773b0736
...
@@ -55,28 +55,16 @@ server {
...
@@ -55,28 +55,16 @@ server {
}
}
}
}
location
/
streaming
/ {
location
/
streaming
/ {
location
~ \.
m3u8
$ {
rewrite
^/
streaming
/(.*)$ /
live
/$
1
?
break
;
rewrite
^/
streaming
/(.*)$ /
live
/$
1
?
break
;
proxy_pass
http
://
localhost
:
1935
;
proxy_pass
http
://
localhost
:
1935
;
proxy_cache
livecache
;
proxy_cache
livecache
;
# do not consider secure urls as new files
proxy_cache_key
$
scheme
$
proxy_host
$
uri
;
proxy_cache_key
$
scheme
$
proxy_host
$
uri
;
proxy_cache_lock
on
;
# only one request at a time will be allowed to populate a new cache element
proxy_cache_min_uses
1
;
proxy_cache_lock
on
;
proxy_cache_use_stale
updating
;
# show if playlist or fragment has been cached from wowza
proxy_cache_valid
200
1
s
;
add_header
X
-
Cache
$
upstream_cache_status
;
}
# wowza is defining expiration headers (m3u8 is 1s, ts is 3600)
location
~ \.
ts
$ {
rewrite
^/
streaming
/(.*)$ /
live
/$
1
?
break
;
proxy_pass
http
://
localhost
:
1935
;
proxy_cache
livecache
;
proxy_cache_key
$
scheme
$
proxy_host
$
uri
;
proxy_cache_lock
on
;
proxy_cache_min_uses
1
;
proxy_cache_valid
200
10
s
;
}
# only urls to ts and m3u8 files are allowed, discard any requested path for other urls
rewrite
^/
streaming
/(.*)$ /
live
/?
break
;
proxy_pass
http
://
localhost
:
1935
/
live
/;
}
}
location
/ {
location
/ {
uwsgi_pass
unix
:///
home
/
msuser
/
mstmp
/
uwsgi
.
sock
;
uwsgi_pass
unix
:///
home
/
msuser
/
mstmp
/
uwsgi
.
sock
;
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment