美文网首页技术干货干货知曰
nginx快速搭建文件下载服务

nginx快速搭建文件下载服务

作者: kevinp | 来源:发表于2014-07-17 15:01 被阅读4415次

简单搭建一个内网下载文件需要的啊皮
在nginx.conf下增加配置:

server {
        listen 80;
        access_log logs/access.download.com.log main;
        error_log logs/error.download.com.log;
        server_name download.com;

        root /data/android;

         location / {
                index index.html;
        }

        location /app {
                default_type application/octet-stream;
        }
}

在/data/android下创建index.html

<!Doctype html>
<html xmlns=http://www.w3.org/1999/xhtml>
        <head>
        <meta http-equiv=Content-Type content="text/html;charset=utf-8">
        <title>Android download page </title>
        </head>
        <body>
                <a href="app/first.apk">apk</a>
        </body>
</html>

将下载的文件放在/data/android/app下。
之后就可以通过download.com访问了,注意nginx服务在其他机器上则需要将在hosts下增加一条配置:

192.168.x.x  download.com

相关文章

网友评论

    本文标题:nginx快速搭建文件下载服务

    本文链接:https://www.haomeiwen.com/subject/ptrstttx.html