Nginx实现文件的上传和下载

文件的上传只要保证特殊的地址先到达Nginx,然后通过Nginx指定至指定的服务器即可,目前配置是本机。文件的下载的做法就是把本机的当前目录下面的文件给返回回去。

server {
listen ;
server_name www.zj***.com zj***.com; #charset koi8-r;
#access_log logs/host.access.log main; #资源上传,保证仅上传至指定的服务器
location ~*/upload/{
proxy_pass http://localhost:;
} location / {
root html;
index index.html index.htm;
#proxy_pass http://localhost:8080;
proxy_pass http://mydomain.com;
proxy_buffer_size 128k;
proxy_buffers 128k;
proxy_busy_buffers_size 128k;
proxy_temp_file_write_size 64m;
} #资源下载
location ~*\.(zip|rar) {
root /home/upload/sourcefile/;
} location ~/static/html{
root /home/upload/;
} location ~/static/js{
root /home/upload/;
} location ~*\.(jpg) {
root /home/upload/video/;
} location ~*\.(mp4|avi|rmvb|rm|MPEG|MPG|DAT|MOV|QT|ASF|WMV) {
root /home/upload/video/;
} }
上一篇:新建maven项目,JRE System Library[J2SE-1.5]


下一篇:Educational Codeforces Round 23 E. Choosing The Commander trie数