nginx.conf 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146
  1. user wuzilong staff;
  2. worker_processes 1;
  3. #error_log logs/error.log;
  4. #error_log logs/error.log notice;
  5. #error_log logs/error.log info;
  6. #pid logs/nginx.pid;
  7. events {
  8. worker_connections 1024;
  9. }
  10. http {
  11. include mime.types;
  12. default_type application/octet-stream;
  13. #log_format main '$remote_addr - $remote_user [$time_local] "$request" '
  14. # '$status $body_bytes_sent "$http_referer" '
  15. # '"$http_user_agent" "$http_x_forwarded_for"';
  16. #access_log logs/access.log main;
  17. sendfile on;
  18. #tcp_nopush on;
  19. #keepalive_timeout 0;
  20. keepalive_timeout 65;
  21. #gzip on;
  22. server {
  23. listen 18989;
  24. server_name localhost;
  25. #charset koi8-r;
  26. #access_log logs/host.access.log main;
  27. location / {
  28. root /Users/wuzilong/work/00code/hzdyjs_xg/web/dist;
  29. index index.html index.htm;
  30. }
  31. # Dify 文件下载代理
  32. location /files/ {
  33. alias /Users/wuzilong/work/00code/dify/dify-1.8.1/api/storage/upload_files/;
  34. # 启用自动索引(可选,用于浏览文件列表)
  35. autoindex on;
  36. autoindex_exact_size off;
  37. autoindex_localtime on;
  38. # 设置缓存
  39. expires 1d;
  40. add_header Cache-Control "public, immutable";
  41. # 安全设置
  42. add_header X-Content-Type-Options nosniff;
  43. add_header X-Frame-Options DENY;
  44. add_header X-XSS-Protection "1; mode=block";
  45. # 支持的文件类型
  46. location ~* \.(txt|pdf|doc|docx|xls|xlsx|ppt|pptx|jpg|jpeg|png|gif|bmp|svg|ico|mp4|avi|mov|mp3|wav)$ {
  47. add_header Content-Disposition "inline";
  48. }
  49. # 处理跨域请求(如果需要)
  50. add_header Access-Control-Allow-Origin *;
  51. add_header Access-Control-Allow-Methods "GET, OPTIONS";
  52. add_header Access-Control-Allow-Headers "Origin, X-Requested-With, Content-Type, Accept";
  53. }
  54. #error_page 404 /404.html;
  55. # redirect server error pages to the static page /50x.html
  56. #
  57. error_page 500 502 503 504 /50x.html;
  58. location = /50x.html {
  59. root html;
  60. }
  61. # proxy the PHP scripts to Apache listening on 127.0.0.1:80
  62. #
  63. #location ~ \.php$ {
  64. # proxy_pass http://127.0.0.1;
  65. #}
  66. # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
  67. #
  68. #location ~ \.php$ {
  69. # root html;
  70. # fastcgi_pass 127.0.0.1:9000;
  71. # fastcgi_index index.php;
  72. # fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name;
  73. # include fastcgi_params;
  74. #}
  75. # deny access to .htaccess files, if Apache's document root
  76. # concurs with nginx's one
  77. #
  78. #location ~ /\.ht {
  79. # deny all;
  80. #}
  81. }
  82. # another virtual host using mix of IP-, name-, and port-based configuration
  83. #
  84. #server {
  85. # listen 8000;
  86. # listen somename:8080;
  87. # server_name somename alias another.alias;
  88. # location / {
  89. # root html;
  90. # index index.html index.htm;
  91. # }
  92. #}
  93. # HTTPS server
  94. #
  95. #server {
  96. # listen 443 ssl;
  97. # server_name localhost;
  98. # ssl_certificate cert.pem;
  99. # ssl_certificate_key cert.key;
  100. # ssl_session_cache shared:SSL:1m;
  101. # ssl_session_timeout 5m;
  102. # ssl_ciphers HIGH:!aNULL:!MD5;
  103. # ssl_prefer_server_ciphers on;
  104. # location / {
  105. # root html;
  106. # index index.html index.htm;
  107. # }
  108. #}
  109. include servers/*;
  110. }