使用nginx最簡單的配置搭建最簡單功能的文件服務器

我的nginx得配置文件路徑在/etc/nginx/nginx.conf文件裏,只要在server配置里加一個location即可

location配置如下:

location /files {
   alias /home/developer/data;
   sendfile on;
   tcp_nodelay on;
   autoindex on;
}

在瀏覽器輸入http://ip:port/files,即可訪問服務器的/home/developer/data目錄。

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章