社区微信群开通啦,扫一扫抢先加入社区官方微信群
社区微信群
安装教程:https://www.cnblogs.com/sunny1009/p/11411673.html
配置server节点下的location部分和server下root指定访问目录
server { listen 80; server_name localhost; root /usr/local/static/; #charset koi8-r; #access_log logs/host.access.log main; location / { autoindex on; #开启索引功能 autoindex_exact_size off; # 关闭计算文件确切大小(单位bytes),只显示大概大小(单位kb、mb、gb) autoindex_localtime on; # 显示本机时间而非 GMT 时间 charset utf-8; # 避免中文乱码 #root html; #index index.html index.htm; } }
./sbin/nginx -t
./sbin/nginx -s reload
浏览器访问输入ip和对应端口号:http://192.168.31.170/
访问文件可以下载,图片可以浏览器直接显示
如果觉得我的文章对您有用,请随意打赏。你的支持将鼓励我继续创作!