Advertisement
Guest User

sysapihttpd.conf from mirouter

a guest
Sep 28th, 2014
740
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 12.68 KB | None | 0 0
  1. #
  2. #httpd for system web api
  3. #
  4. user root root;
  5. worker_processes 2;
  6. worker_rlimit_nofile 1024;
  7. #
  8. #/etc/init.d/sysapihttpd
  9. #
  10. #error log will send to stdout and save by syslog
  11. #
  12. daemon off;
  13. #master_process off;
  14.  
  15. #nginx connect() failed (128: Unknown error) is Destination Net Unreachable
  16. #debug | info | notice | warn | error | crit
  17. error_log stderr warn;
  18.  
  19. #pid logs/nginx.pid;
  20.  
  21. events {
  22. use epoll;
  23. worker_connections 512;
  24. }
  25.  
  26. http {
  27. #
  28. include mime.types;
  29. default_type application/octet-stream;
  30.  
  31. #\t"$upstream_cache_status" replaced by \t"$sent_http_ MiCGI_Cache_Status"
  32. log_format main '"$server_addr"\t"$host"\t"$remote_addr"\t"$time_local"\t"$request_method $request_uri"\t"$status"\t"$request_length"\t"$bytes_sent"\t"$request_time"\t"$sent_http_ MiCGI_Cache_Status"\t"$upstream_addr"\t"$upstream_response_time"\t"$http_referer"\t"$http_user_agent"';
  33.  
  34. #access_log /userdisk/sysapihttpd/log/access.log main;
  35. access_log off;
  36.  
  37. sendfile on;
  38. #tcp_nopush on;
  39.  
  40. #http://wiki.nginx.org/HttpCoreModule#server_tokens
  41. server_tokens off;
  42.  
  43. #disable keepalive for webinitrdr
  44. keepalive_timeout 0;
  45.  
  46. # zeor for no max limit
  47. client_max_body_size 0;
  48. #
  49. proxy_buffering on;
  50. proxy_max_temp_file_size 2m;
  51.  
  52. proxy_buffer_size 256k;
  53. proxy_buffers 32 32k;
  54. proxy_busy_buffers_size 256k;
  55.  
  56. server_names_hash_bucket_size 64;
  57. proxy_headers_hash_bucket_size 128;
  58. proxy_headers_hash_max_size 8192;
  59.  
  60. #https://groups.google.com/forum/#!msg/openresty/sgNvuGk0tlQ/lFxfl-mg9HMJ
  61. #2013/08/08 11:50:03 [error] 3971#0: wrong ident 16756 response for www.youtube.com, expect 35660
  62.  
  63. proxy_connect_timeout 186;
  64. proxy_read_timeout 1200;
  65. proxy_send_timeout 1200;
  66.  
  67. #gzip on;
  68. #gzip_min_length 1024;
  69. #gzip_proxied expired no-cache no-store private auth no_last_modified no_etag;
  70. #gzip_types application/json application/x-json text/css text/xml text/plain application/xml;
  71. #gzip_disable "MSIE [1-6]\.";
  72.  
  73. fastcgi_connect_timeout 300;
  74. fastcgi_read_timeout 300;
  75. fastcgi_send_timeout 300;
  76. fastcgi_buffer_size 64k;
  77. fastcgi_buffers 4 32k;
  78. fastcgi_busy_buffers_size 64k;
  79. fastcgi_temp_file_write_size 64k;
  80.  
  81. limit_conn_zone $binary_remote_addr zone=addr_zone:256k;
  82.  
  83. server {
  84. #
  85. #server for sysapi
  86. #
  87. listen 0.0.0.0:80;
  88. listen 0.0.0.0:8098;
  89. server_name _;
  90. access_log off;
  91. #access_log /userdisk/sysapihttpd/log/luaroot.access.log main;
  92.  
  93. log_not_found off;
  94.  
  95. #
  96. keepalive_timeout 0;
  97.  
  98. ##r1cm has disk space
  99. upload_reserve_free_memory 0;
  100.  
  101. #
  102. root /www;
  103. index index.html index.htm;
  104.  
  105. # 0.0.0.1:65535 no avaible
  106. #redirect 0.0.0.1:65535 127.0.0.1:5081;
  107.  
  108. #disable proxy errors handle
  109. proxy_intercept_errors off;
  110.  
  111. #http://wiki.nginx.org/HttpCoreModule#reset_timedout_connection
  112. reset_timedout_connection on;
  113.  
  114. expires epoch;
  115. #
  116. include 'miwifi-webinitrd.conf';
  117. #
  118.  
  119. location = /miwifi.html
  120. {
  121. root /etc/sysapihttpd/htdocs/;
  122. }
  123. location = /stat/proxy.shtml {
  124. #
  125. keepalive_timeout 0;
  126. access_log off;
  127. #
  128. add_header MiCGI-StatChain STAT;
  129. proxy_set_header Host miwifi.com;
  130. proxy_pass http://127.0.0.1:5081;
  131. #
  132. }
  133. location /backup/share {
  134. alias /userdisk/data/;
  135. }
  136. location /backup/privacy {
  137. alias /userdisk/privacyData/;
  138. }
  139. location /backup/thumbnail/share {
  140. alias /userdisk/.thumbnails/smallIcons/userdisk/data/;
  141. }
  142. location /backup/thumbnail/privacy {
  143. alias /userdisk/.thumbnails/smallIcons/userdisk/privacyData/;
  144. }
  145. location /api/service/plugin {
  146. rewrite ^/api/service/plugin/control /api-third-party/download/private/$arg_appid/control.html? permanent;
  147. }
  148. location /api-third-party/download/public {
  149. alias /userdisk/data/;
  150. }
  151. location /api-third-party/download/private {
  152. alias /userdisk/appdata/;
  153. }
  154. location /api-third-party/service {
  155. #
  156. add_header MiCGI-Switch "$finalvar";
  157. add_header MiCGI-Client-Ip $remote_addr;
  158. add_header MiCGI-Host $host;
  159. add_header MiCGI-Http-Host $http_host;
  160. add_header MiCGI-Server-Ip $server_addr;
  161. add_header MiCGI-Server-Port $server_port;
  162. add_header MiCGI-Status CGI;
  163. add_header MiCGI-Preload no;
  164. #
  165. if ($uri = "/api-third-party") {
  166. set $path_info $1;
  167. set $script_name '/cgi-bin/luci';
  168. set $luci_path '/www';
  169. }
  170. if ($uri ~ "^/api-third-party(/.+)") {
  171. set $path_info $1;
  172. set $script_name '/cgi-bin/luci';
  173. set $luci_path '/www';
  174. }
  175. #
  176. include 'fastcgi-proxy-pass.conf';
  177. #
  178. }
  179. location /uploadfile/cgi-bin {
  180. #
  181. #for POST /uploadfile/cgi-bin/luci/;stok=42822adbabf606fe7946cd2e9b98d9a5/api/xqsystem/upload_rom
  182. #
  183. add_header MiCGI-Switch "$finalvar";
  184. add_header MiCGI-Client-Ip $remote_addr;
  185. add_header MiCGI-Host $host;
  186. add_header MiCGI-Http-Host $http_host;
  187. add_header MiCGI-Server-Ip $server_addr;
  188. add_header MiCGI-Server-Port $server_port;
  189. add_header MiCGI-Status CGI;
  190. add_header MiCGI-Preload no;
  191. add_header MiCGI-Upload-File yes;
  192. # for upload roms only [start]
  193. client_body_temp_path /tmp/uploadfiles/;
  194. client_body_in_file_only on;
  195. client_body_buffer_size 16k;
  196. proxy_pass_request_headers on;
  197. proxy_set_body off;
  198. proxy_redirect off;
  199. fastcgi_param UPLOADFILE $request_body_file;
  200. upload_reserve_free_memory 1M;
  201. client_max_body_size 128M;
  202. #TODO: upload_multipart_cut
  203. #upload_multipart_cut on;
  204. fastcgi_max_temp_file_size 0;
  205. # for upload rom only [end]
  206. #
  207. include 'fastcgi-proxy-pass.conf';
  208. #
  209. }
  210. location /cgi-bin {
  211. #
  212. add_header MiCGI-Switch "$finalvar";
  213. add_header MiCGI-Client-Ip $remote_addr;
  214. add_header MiCGI-Host $host;
  215. add_header MiCGI-Http-Host $http_host;
  216. add_header MiCGI-Server-Ip $server_addr;
  217. add_header MiCGI-Server-Port $server_port;
  218. add_header MiCGI-Status CGI;
  219. add_header MiCGI-Preload no;
  220. #
  221. include 'fastcgi-proxy-pass.conf';
  222. #
  223. }
  224. location = /upload {
  225. #
  226. #TODO: fix r1cm memory usage
  227. #
  228. upload_pass /cgi-bin/upload;
  229. upload_cleanup 400 404 499 500-505;
  230. upload_store /userdisk/sysapihttpd/.upload_tmp;
  231. upload_store_access user:rw group:rw all:rw;
  232. upload_max_file_size 0;
  233. upload_limit_rate 0;
  234. upload_set_form_field "${upload_field_name}_name" $upload_file_name;
  235. upload_set_form_field "${upload_field_name}_content_type" $upload_content_type;
  236. upload_set_form_field "${upload_field_name}_path" $upload_tmp_path;
  237. upload_aggregate_form_field "${upload_field_name}_md5" $upload_file_md5;
  238. upload_aggregate_form_field "${upload_field_name}_size" $upload_file_size;
  239. upload_pass_form_field "^.*$";
  240. upload_pass_args on;
  241.  
  242. limit_conn addr_zone 10;
  243. }
  244. location ^~ /download-userdisk/ {
  245. internal;
  246. alias /userdisk/data/;
  247. }
  248. location ^~ /download-extdisks/ {
  249. internal;
  250. alias /extdisks/;
  251. }
  252. location ^~ /download-pridisk/ {
  253. internal;
  254. alias /userdisk/privacyData/;
  255. }
  256. #
  257. location / {
  258. #
  259. add_header MiCGI-Switch "$finalvar";
  260. add_header MiCGI-TproxyInfo "$dst_addr:$dst_port";
  261. add_header MiCGI-Upstream "$target_upstream";
  262. add_header MiCGI-Client-Ip $remote_addr;
  263. add_header MiCGI-Host $host;
  264. add_header MiCGI-Http-Host $http_host;
  265. add_header MiCGI-Server-Ip $server_addr;
  266. add_header MiCGI-Server-Port $server_port;
  267. add_header MiCGI-Status LUAROOT;
  268. add_header MiCGI-Preload no;
  269. #
  270. root /www;
  271. index index.html index.htm;
  272. #
  273. }
  274. #
  275. #**#error_page 404 /err/404.html;
  276. #**#error_page 500 /err/500.html;
  277. #**#error_page 501 /err/502.html;
  278. #**#error_page 502 /err/502.html;
  279. #**#error_page 503 /err/503.html;
  280. #**#error_page 504 /err/504.html;
  281. #
  282. location ~ /err/ {
  283. #
  284. internal;
  285. #
  286. access_log off;
  287. keepalive_timeout 0;
  288. #
  289. add_header MiCGI-Client-Ip $remote_addr;
  290. add_header MiCGI-Host $host;
  291. add_header MiCGI-Http-Host $http_host;
  292. add_header MiCGI-Server-Ip $server_addr;
  293. add_header MiCGI-Server-Port $server_port;
  294. add_header MiCGI-Preload no;
  295. #
  296. add_header MiCGI-Status ERR-HTML;
  297. add_header Cache-Control 'private,max-age=0';
  298. expires epoch;
  299. add_header Content-Type "text/html;charset=utf-8";
  300. #
  301. root /www/;
  302. }
  303. #
  304.  
  305. location /sign_msg{
  306. sign_msg;
  307. sign_msg_config_file_path /userdisk/appdata/2882303761517185825/etc/plugin_config;
  308. client_body_in_file_only on;
  309. client_body_temp_path /tmp 1;
  310.  
  311. add_header 'Access-Control-Allow-Origin' "$http_origin";
  312. add_header 'Access-Control-Allow-Credentials' 'true';
  313. }
  314.  
  315. location /welcome{
  316. welcome_command;
  317. add_header 'Access-Control-Allow-Origin' "$http_origin";
  318. add_header 'Access-Control-Allow-Credentials' 'true';
  319. }
  320.  
  321. location /mp4_movie_info {
  322. proxy_pass http://192.168.31.1:8300;
  323. proxy_set_header Accept-Encoding "";
  324. proxy_method GET;
  325. }
  326.  
  327. location /video{
  328. welcome_video;
  329. add_header 'Access-Control-Allow-Origin' "$http_origin";
  330. add_header 'Access-Control-Allow-Credentials' 'true';
  331. }
  332.  
  333. }
  334. #mac black list info server
  335. server {
  336. #server for mac black list
  337. listen 1183;
  338. server_name _;
  339. access_log off;
  340. #TODO: disable debug
  341. #access_log /userdisk/sysapihttpd/log/blacklist.access.log main;
  342.  
  343. #error_log /userdisk/sysapihttpd/log/error.log notice;
  344. error_log /dev/null notice;
  345.  
  346. log_not_found off;
  347.  
  348. root /data/nginx/htdocs/blacklist/;
  349. index index.html index.htm;
  350. add_header MiCGI-Status BLACKLIST;
  351.  
  352. location = /stat/proxy.shtml {
  353. #
  354. include 'stat.conf';
  355. #
  356. }
  357.  
  358. #error_page 404 /404.html;
  359.  
  360. }
  361. server {
  362. #request info/stat server
  363. listen 127.0.0.1:5081;
  364. server_name _;
  365. access_log off;
  366.  
  367. log_not_found off;
  368. keepalive_timeout 0;
  369.  
  370. #
  371. root /etc/nginx/htdocs/;
  372. index index.html index.htm;
  373. #
  374. #
  375. include 'stat.conf';
  376. #
  377. }
  378.  
  379. server {
  380. listen 8192;
  381. add_header Safe-Mark 'xiaomi';
  382. server_name _;
  383. #error_log /userdisk/data/safe.log debug;
  384. access_log off;
  385. resolver 127.0.0.1 valid=30s;
  386.  
  387. location / {
  388. set_escape_uri $params $scheme://$host$request_uri;
  389. rewrite ^ http://miwifi.com/cgi-bin/luci/web/safeurl?safeurl=${params}? break;
  390. }
  391. }
  392.  
  393. preload_zone zone=web_preload_zone:16k;
  394. server {
  395. listen 8193;
  396. server_name _;
  397. #error_log /userdisk/sysapihttpd/log/error.log info;
  398. access_log off;
  399.  
  400. location / {
  401. add_header Cache-Mark 'xiaomi';
  402. preload /userdisk/cachecenter/cache_dir/ /http_proxy/ web_preload_zone;
  403. }
  404.  
  405. resolver 127.0.0.1 valid=30s;
  406. location /http_proxy {
  407. internal;
  408. add_header Proxy-Mark 'xiaomi';
  409. rewrite /http_proxy/ / break;
  410. proxy_pass http://$http_host$request_uri;
  411. }
  412. }
  413.  
  414. server {
  415. listen 127.0.0.1:8194;
  416. preload_statistics web_preload_zone;
  417. }
  418.  
  419. ad_filter_zone zone=ad_filter_zone:16k;
  420. server {
  421. listen 127.0.0.1:8195;
  422. #error_log /userdisk/sysapihttpd/log/error.log info;
  423. ad_filter_statistics ad_filter_zone;
  424. }
  425. server {
  426. listen 8196;
  427. # resolver 8.8.8.8;
  428. resolver 127.0.0.1 valid=30s;
  429. log_format proxy_log '"$server_addr"\t"$host"\t"$remote_addr"\t"$time_local"\t"$request_method $request_uri"\t"$status"\t"$request_length"\t"$bytes_sent"\t"$request_time"\t"$sent_http_ MiCGI_Cache_Status"\t"$upstream_addr"\t"$upstream_response_time"\t"$http_referer"\t"$http_user_agent"';
  430. access_log off;
  431. #access_log /userdisk/data/proxy_8194.log proxy_log;
  432. #error_log /userdisk/sysapihttpd/log/error.log info;
  433.  
  434. location / {
  435. add_header AD-Mark 'xiaomi';
  436. ad_filter /proxy/ ad_filter_zone;
  437. }
  438. location /proxy {
  439. internal;
  440. add_header Proxy-Mark 'xq-proxy';
  441. rewrite /proxy/ / break;
  442. proxy_pass http://$http_host$request_uri;
  443. }
  444. }
  445.  
  446. server {
  447. listen 8999;
  448.  
  449. location /{
  450. welcome_upstream;
  451. welcome_upstream_config_file_path /userdisk/appdata/2882303761517185825/etc/plugin_config;
  452. }
  453.  
  454. error_page 404 /404.html;
  455. # redirect server error pages to the static page /50x.html
  456. #
  457. error_page 500 502 503 504 /50x.html;
  458. location = /50x.html {
  459. root /www/err/;
  460. }
  461.  
  462. location = /404.html {
  463. root /www/err/;
  464. }
  465. }
  466.  
  467. }
  468.  
  469. #
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement