Sheep

relax and retry

0%

Nginx 快速搭建文件服务器

Nginx 快速搭建文件服务器

  • OS: ubuntu:16.04

1. Installation

script
1
[sudo] apt install nginx

2. Configuration

script
1
[sudo] vim /etc/nginx/sites-enabled/default

with config:

script
1
2
3
4
5
6
7
8
9
10
11
server {
listen 80 default_server;
listen [::]:80 default_server;
root /mnt/volume_sgp1_01; # The shared file path
server_name 128.199.80.31;
location / {
autoindex on; # 索引
autoindex_exact_size on; # 显示文件大小
autoindex_localtime on; # 显示文件时间
}
}

3. Apply

script
1
2
3
[sudo] chmod -R /mnt/volume_sgp1_01
[sudo] service nginx reload
[sudo] service nginx restart

4. Close

script
1
[sudo] service nginx stop