当前位置:   article > 正文

文件下载和上传功能服务器搭建配置_文件下载服务器

文件下载服务器

参考总结:3种实现文件下载和上传功能的服务器搭建配置


一、nginx

二、miniserve

三、nodejs


一、nginx

效果如下(暂时只有文件下载功能,文件上传功能还没有配置)

 Windows下

1.1下载

nginx: download

1.2解压

1.3运行

运行nginx.exe,在浏览器中输入localhost,出现下图表示成功

1.4配置nginx

nginx配置文件详解可以百度一下,太长就不写了,就给个我自己的配置

nginx默认端口是80,可以更改避免出现端口占用。location配置较为关键,我配了两个

局域网内浏览器输入:http://localhost/downloadtest/  http://localhost/apk/即可访问实现文件下载

  1. #user nobody;
  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 80;
  24. server_name localhost;
  25. charset utf-8;
  26. #charset koi8-r;
  27. #access_log logs/host.access.log main;
  28. #location / {
  29. # root html;
  30. # index index.html index.htm;
  31. #}
  32. location /apk {
  33. root F:\\DownloadTest;
  34. autoindex on;
  35. autoindex_exact_size off;
  36. autoindex_localtime on;
  37. }
  38. location /downloadtest {
  39. root F:\\DownloadTest;
  40. autoindex on;
  41. autoindex_exact_size off;
  42. autoindex_localtime on;
  43. }
  44. #error_page 404 /404.html;
  45. # redirect server error pages to the static page /50x.html
  46. #
  47. #error_page 500 502 503 504 /50x.html;
  48. #location = /50x.html {
  49. # root html;
  50. #}
  51. # proxy the PHP scripts to Apache listening on 127.0.0.1:80
  52. #
  53. #location ~ \.php$ {
  54. # proxy_pass http://127.0.0.1;
  55. #}
  56. # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
  57. #
  58. #location ~ \.php$ {
  59. # root html;
  60. # fastcgi_pass 127.0.0.1:9000;
  61. # fastcgi_index index.php;
  62. # fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name;
  63. # include fastcgi_params;
  64. #}
  65. # deny access to .htaccess files, if Apache's document root
  66. # concurs with nginx's
声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/我家小花儿/article/detail/232429
推荐阅读
相关标签
  

闽ICP备14008679号