Created
May 10, 2016 17:24
-
-
Save anonymous/07a89471f2d2c7a18bda8f0464c3091e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
if (isset($_GET['mp3'])) { | |
if (isset($_SERVER['HTTP_RANGE'])) { | |
http_response_code(206); | |
} | |
header('Content-Type: audio/mpeg; name="ololo.mp3"'); | |
header('X-Accel-Redirect: /internal_redirect_on/25/0/0/0/0/0/0/ololo.mp3/127.0.0.1/test.mp3'); | |
header('X-Accel-Limit-Rate: 100000'); | |
exit; | |
} | |
?><!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8" /> | |
<title>demo</title> | |
</head> | |
<body> | |
<audio src="audio.demo.php?mp3&time=<?=time()?>" controls="controls" preload="none"></audio> | |
</body> | |
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
server { | |
listen 127.0.0.1:80; | |
server_name localhost2; | |
access_log logs/host.access.log main; | |
set $root C:/nginx/html; | |
location / { | |
root $root; | |
} | |
location ~ \.php$ { | |
root $root; | |
fastcgi_pass 127.0.0.1:9000; | |
fastcgi_index index.php; | |
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; | |
include fastcgi_params; | |
} | |
location ~ ^/internal_redirect_on/(?P<var1>.+?)/(?P<var2>.+?)/(?P<var3>.+?)/(?P<var4>.+?)/(?P<var5>.+?)/(?P<var6>.+?)/(?P<var7>.+?)/(?P<var8>.+?)/(?P<extdomain>.+?)/(?P<fullurl>.*) { | |
internal; | |
set $download_host $extdomain; | |
set $download_uri $fullurl; | |
set $download_url http://$download_host/$fullurl$is_args$args; | |
set $alias_path $var1/$var2/$var3/$var4/$var5/$var6/$var7/$var8; | |
proxy_set_header Host $download_host; | |
proxy_set_header Authorization ''; | |
proxy_set_header Range ''; #caching work, but 206 is not set | |
proxy_pass $download_url; | |
proxy_store C:/nginx/html/cache/$alias_path; | |
proxy_temp_path C:/nginx/html/cache/nginx 2 2 2; | |
proxy_store_access user:rw group:rw all:r; | |
} | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment