1.前言
当我们希望分享自己的文件时,有多种方式,局域网可以采用共享,rtx传输,qq传输,发送到邮箱,直接u盘拷贝等等。但最简单的就是开启本地主机,其他电脑通过网页的方式直接下载,这里介绍使用nginx作为主机进行下载
2.步骤
1.下载nginx http://nginx.org/en/download.html 目前稳定版本为1.80 解压到一个目录
2.修改配置文件
nginx.conf
#user nobody; worker_processes 1; #error_log logs/error.log; #error_log logs/error.log notice; #error_log logs/error.log info; #pid logs/nginx.pid; events { worker_connections 1024; } http { include mime.types; default_type application/octet-stream; #log_format main '$remote_addr - $remote_user [$time_local] "$request" ' # '$status $body_bytes_sent "$http_referer" ' # '"$http_user_age
3.在nginx目录下的html中建立目录test和test.rar文件
4.打开命令行切换到nginx目录
4.1测试脚本 nginx -t
4.2开启主机 start nginx
4.3打开浏览器 http://localhost:8080/test/test.rar应该弹出另存为对话框
4.4关闭主机nginx -s quit