Advertisement
Guest User

Untitled

a guest
Aug 20th, 2014
195
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 9.09 KB | None | 0 0
  1. server {
  2. server_name *.ag.wap3.com.ua;
  3. client_max_body_size 500M;
  4. client_body_buffer_size 500M;
  5. client_body_timeout 3600;
  6. keepalive_timeout 3600;
  7. location / {
  8. proxy_pass http://127.0.0.1:8080;
  9. proxy_set_header Host $host:80;
  10. proxy_set_header X-Real-IP $remote_addr;
  11. ##proxy_set_header 'Access-Control-Allow-Origin' '*';
  12. add_header 'Access-Control-Allow-Origin' "*";
  13. if ($request_method = 'OPTIONS') {
  14. add_header 'Access-Control-Allow-Methods' 'GET, POST, PUT, OPTIONS';
  15. add_header 'Access-Control-Allow-Headers' 'Authorization,Content-Type,Accept,Origin,User-Agent,DNT,Cache-Control,X-Mx-ReqToken,Keep-Alive,X-Requested-With,If-Modified-Since';
  16. }
  17. }
  18. location /p/ {
  19.  
  20. ## This must match the URI part related to the MD5 hash and expiration time.
  21. secure_link $arg_st,$arg_e;
  22. ## The MD5 hash is built from our secret token, the URI($path in PHP) and our expiration time.
  23. secure_link_md5 segredo$uri$arg_e;
  24. ## If the hash is incorrect then $secure_link is a null string.
  25. if ($secure_link = "") {
  26. return 403;
  27. }
  28. ## The current local time is greater than the specified expiration time.
  29. if ($secure_link = "0") {
  30. return 410;
  31. }
  32. ## If everything is ok $secure_link is 1.
  33. }
  34.  
  35. location ~ ^/audio/track/play/image/(?<secure>[\w-]+,\d+)/(?<hentity>[\w-]+)/(?<hpath>[\w-]+)/(?<hyear>[\w-]+)/(?<hwidth>[\w-]+)/(?<hheight>[\w-]+)/(?<secured_stuff>.+)$ {
  36. proxy_set_header Host $host;
  37. ## This must match the URI part related to the MD5 hash and expiration time.
  38. secure_link $secure;
  39.  
  40. # The MD5 hash is built from our secret token, the URI($path in PHP) and our expiration time.
  41. secure_link_md5 piypiyololo$secured_stuff$hpath$secure_link_expires;
  42.  
  43. ## If the hash is incorrect then $secure_link is a null string.
  44. if ($secure_link = "") {
  45. return 403;
  46. }
  47.  
  48. ## The current local time is greater than the specified expiration time.
  49. if ($secure_link = "0") {
  50. return 410;
  51. }
  52.  
  53. ## If everything is ok $secure_link is 1.
  54. alias /web/$host/app/uploads/media/$hentity/$hpath/$hyear/$secured_stuff;
  55. try_files "" @404;
  56. image_filter resize $hwidth $hheight;
  57. }
  58.  
  59.  
  60. location ~ ^/audio/track/play/(?<secure>[\w-]+,\d+)/(?<hentity>[\w-]+)/(?<hpath>[\w-]+)/(?<hyear>[\w-]+)/(?<secured_stuff>.+)$ {
  61. proxy_set_header Host $host;
  62. ## This must match the URI part related to the MD5 hash and expiration time.
  63. secure_link $secure;
  64.  
  65. # The MD5 hash is built from our secret token, the URI($path in PHP) and our expiration time.
  66. secure_link_md5 piypiyololo$secured_stuff$hpath$secure_link_expires;
  67.  
  68. ## If the hash is incorrect then $secure_link is a null string.
  69. if ($secure_link = "") {
  70. return 403;
  71. }
  72.  
  73. ## The current local time is greater than the specified expiration time.
  74. if ($secure_link = "0") {
  75. return 410;
  76. }
  77.  
  78. ## If everything is ok $secure_link is 1.
  79. alias /web/$host/app/uploads/media/$hentity/$hpath/$hyear/$secured_stuff;
  80. }
  81.  
  82. location ~ ^/profile/picture/([^/]+)/([^/]+)/(\d+)_(\d+)_(\d+)(.*\.(?:jpg|jpeg|gif|png))$ {
  83. proxy_set_header Host $host;
  84. set $path1 $1;
  85. set $path2 $2;
  86. set $userId $3;
  87. set $width $4;
  88. set $height $5;
  89. set $ext $6;
  90.  
  91. alias /web/$host/app/uploads/media/userprofile/$1/$2/$userId$ext;
  92. try_files "" @404;
  93. image_filter resize $width $height;
  94. }
  95.  
  96. location ~ ^/banner/media/([^/]+)/([^/]+)/(\d+)_(\d+)_(\d+)(.*\.(?:jpg|jpeg|gif|png))$ {
  97. proxy_set_header Host $host;
  98. set $path1 $1;
  99. set $path2 $2;
  100. set $userId $3;
  101. set $width $4;
  102. set $height $5;
  103. set $ext $6;
  104.  
  105. alias /web/$host/app/uploads/media/banner/$1/$2/$userId$ext;
  106. try_files "" @404;
  107. image_filter resize $width $height;
  108. }
  109.  
  110.  
  111. location ~ ^/jingle/media/([^/]+)/([^/]+)/(\d+)_(\d+)_(\d+)(.*\.(?:jpg|jpeg|gif|png))$ {
  112. proxy_set_header Host $host;
  113. set $path1 $1;
  114. set $path2 $2;
  115. set $id $3;
  116. set $width $4;
  117. set $height $5;
  118. set $ext $6;
  119.  
  120. alias /web/$host/app/uploads/media/jingle/$1/$2/$id$ext;
  121. try_files "" @404;
  122. image_filter resize $width $height;
  123. }
  124.  
  125. location ~ ^/partner/media/([^/]+)/([^/]+)/(\d+)_(\d+)_(\d+)(.*\.(?:jpg|jpeg|gif|png))$ {
  126. proxy_set_header Host $host;
  127. set $path1 $1;
  128. set $path2 $2;
  129. set $userId $3;
  130. set $width $4;
  131. set $height $5;
  132. set $ext $6;
  133.  
  134. alias /web/$host/app/uploads/media/partner/$1/$2/$userId$ext;
  135. try_files "" @404;
  136. image_filter resize $width $height;
  137. }
  138.  
  139. location ~ ^/special/media/([^/]+)/([^/]+)/(\d+)(.*\.(?:jpg|jpeg|gif|png))$ {
  140. proxy_set_header Host $host;
  141. set $path1 $1;
  142. set $path2 $2;
  143. set $id $3;
  144. set $ext $4;
  145.  
  146. alias /web/$host/app/uploads/media/speczone/$1/$2/$id$ext;
  147. try_files "" @404;
  148. }
  149.  
  150. location ~ ^/special/audio/([^/]+)/([^/]+)/(\d+)_(\d+)_(\d+)(.*\.(?:jpg|jpeg|gif|png))$ {
  151. proxy_set_header Host $host;
  152. set $path1 $1;
  153. set $path2 $2;
  154. set $id $3;
  155. set $width $4;
  156. set $height $5;
  157. set $ext $6;
  158.  
  159. alias /web/$host/app/uploads/media/speczone_audio/$1/$2/$id$ext;
  160. try_files "" @404;
  161. image_filter resize $width $height;
  162. }
  163.  
  164. location @404 { return 404; }
  165.  
  166. types {
  167. application/vnd.ms-fontobject eot;
  168. application/font-woff woff;
  169. font/otf otf;
  170. font/ttf ttf;
  171. audio/mpeg mp3;
  172. }
  173.  
  174. location ~ ^/media/([^/]+)/([^/]+)/([^/]+)/(\d+)/(\d+)/(\d+)(.*\.(?:jpg|jpeg|gif|png))$ {
  175. proxy_set_header Host $host;
  176. set $context $1;
  177. set $path1 $2;
  178. set $path2 $3;
  179. set $width $4;
  180. set $height $5;
  181. set $id $6;
  182. set $ext $7;
  183.  
  184. alias /web/$host/server/app/uploads/media/$1/$2/$3/$id$ext;
  185. try_files "" @404;
  186. image_filter_buffer 10M;
  187. image_filter resize $width $height;
  188. }
  189.  
  190. ##QUIZ
  191. # location ~ ^/media/([^/]+)/([^/]+)/([^/]+)/(\d+)(.*\.(?:mp3|ogg))$ {
  192. # proxy_set_header Host $host;
  193. # set $context $1;
  194. # set $path1 $2;
  195. # set $path2 $3;
  196. # set $id $4;
  197. # set $ext $5;
  198. #
  199. # alias /web/$host/server/app/uploads/media/$1/$2/$3/$id$ext;
  200. # try_files "" @404;
  201. # }
  202. ##House
  203. location ~ ^/storage/image/([^/]+)/([^/]+)/([^/]+)/(\d+)/(\d+)/(\d+)(.*\.(?:jpg|jpeg|gif|png))$ {
  204. proxy_set_header Host $host;
  205. set $context $1;
  206. set $path1 $2;
  207. set $path2 $3;
  208. set $width $4;
  209. set $height $5;
  210. set $id $6;
  211. set $ext $7;
  212.  
  213. alias /web/$host/app/storage/$1/$2/$3/$id$ext;
  214. try_files "" @404;
  215. image_filter resize $width $height;
  216. }
  217.  
  218.  
  219. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement