nginx.conf 1.1 KB

123456789101112131415161718192021222324252627282930313233343536
  1. worker_processes 2; ## 默认1,一般建议设成CPU核数1-2倍
  2. error_log /var/log/error.log; ## 错误日志路径
  3. pid /var/log/nginx.pid; ## 进程id
  4. events {
  5. use epoll;
  6. worker_connections 2048;
  7. }
  8. http {
  9. client_max_body_size 1024m;
  10. default_type application/octet-stream; # 默认文件类型
  11. # 日志格式及access日志路径
  12. log_format main '$remote_addr - $remote_user [$time_local] $status '
  13. '"$request" $body_bytes_sent "$http_referer" '
  14. '"$http_user_agent" "$http_x_forwarded_for"';
  15. access_log /var/log/access.log main;
  16. sendfile on;
  17. tcp_nopush on; # sendfile开启时才开启。
  18. proxy_connect_timeout 900; #单位秒
  19. proxy_send_timeout 900; #单位秒
  20. proxy_read_timeout 900; #单位秒
  21. server {
  22. listen 80;
  23. add_header 'Access-Control-Allow-Origin' '*';
  24. add_header 'Access-Control-Allow-Methods' '*';
  25. add_header 'Access-Control-Allow-Headers' '*';
  26. location /watch {
  27. proxy_pass https://www.youtube.com/watch;
  28. }
  29. }
  30. }