nginx.conf 3.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. worker_processes 2; ## 默认1,一般建议设成CPU核数1-2倍
  2. events {
  3. worker_connections 2048;
  4. }
  5. http {
  6. access_log ./access.log;
  7. error_log ./error.log;
  8. client_max_body_size 1024m;
  9. default_type application/octet-stream; # 默认文件类型
  10. # 日志格式及access日志路径
  11. log_format main '$remote_addr - $remote_user [$time_local] $status '
  12. '"$request" $body_bytes_sent "$http_referer" '
  13. '"$http_user_agent" "$http_x_forwarded_for"';
  14. sendfile on;
  15. tcp_nopush on; # sendfile开启时才开启。
  16. proxy_connect_timeout 900; #单位秒
  17. proxy_send_timeout 900; #单位秒
  18. proxy_read_timeout 900; #单位秒
  19. server {
  20. listen 80;
  21. proxy_hide_header 'Vary';
  22. add_header 'Access-Control-Allow-Origin' '*' always;
  23. add_header 'Access-Control-Allow-Methods' '*' always;
  24. add_header 'Access-Control-Allow-Headers' '*' always;
  25. location / {
  26. if ($request_method = OPTIONS) {
  27. add_header 'Access-Control-Allow-Origin' '*' always;
  28. add_header 'Access-Control-Allow-Methods' '*' always;
  29. add_header 'Access-Control-Allow-Headers' '*' always;
  30. return 204;
  31. }
  32. proxy_pass https://www.youtube.com/;
  33. }
  34. }
  35. server {
  36. listen 81;
  37. proxy_hide_header 'Vary';
  38. add_header 'Access-Control-Allow-Origin' '*' always;
  39. add_header 'Access-Control-Allow-Methods' '*' always;
  40. add_header 'Access-Control-Allow-Headers' '*' always;
  41. location / {
  42. if ($request_method = OPTIONS) {
  43. add_header 'Access-Control-Allow-Origin' '*' always;
  44. add_header 'Access-Control-Allow-Methods' '*' always;
  45. add_header 'Access-Control-Allow-Headers' '*' always;
  46. return 204;
  47. }
  48. proxy_pass https://cn.pornhub.com/;
  49. }
  50. }
  51. server {
  52. listen 82;
  53. proxy_hide_header 'Vary';
  54. add_header 'Access-Control-Allow-Origin' '*' always;
  55. add_header 'Access-Control-Allow-Methods' '*' always;
  56. add_header 'Access-Control-Allow-Headers' '*' always;
  57. location / {
  58. if ($request_method = OPTIONS) {
  59. add_header 'Access-Control-Allow-Origin' '*' always;
  60. add_header 'Access-Control-Allow-Methods' '*' always;
  61. add_header 'Access-Control-Allow-Headers' '*' always;
  62. return 204;
  63. }
  64. proxy_pass https://www.xvideos.com/;
  65. }
  66. }
  67. server {
  68. listen 83;
  69. proxy_hide_header 'Vary';
  70. add_header 'Access-Control-Allow-Origin' '*' always;
  71. add_header 'Access-Control-Allow-Methods' '*' always;
  72. add_header 'Access-Control-Allow-Headers' '*' always;
  73. location / {
  74. if ($request_method = OPTIONS) {
  75. add_header 'Access-Control-Allow-Origin' '*' always;
  76. add_header 'Access-Control-Allow-Methods' '*' always;
  77. add_header 'Access-Control-Allow-Headers' '*' always;
  78. return 204;
  79. }
  80. proxy_pass https://music.youtube.com/;
  81. }
  82. }
  83. }