技术干货干货知曰

nginx快速搭建文件下载服务

2014-07-17  本文已影响4415人  kevinp

简单搭建一个内网下载文件需要的啊皮
在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
上一篇 下一篇

猜你喜欢

热点阅读