1.修改nginx虚拟主机配置
# vim /etc/nginx/conf.d/share_file.conf
server {
listen 80;
server_name localhost;charset utf-8; #字符显示编码集utf-8不设置网页内容可能无法显示中文
access_log /var/log/nginx/host.access.log main;location / {
root /home/product; #指定实际目录绝对路径
autoindex on; #开启目录浏览功能
autoindex_exact_size off; #默认开启为on,显示出文件的确切大小,单位是bytes。关闭为off,显示出文件大概大小,单位为kB,MB或GB
autoindex_localtime on; #默认为off,显示的文件时间为GMT时间。改为on后,显示的文件时间为文件的服务器时间
}
}
2.重载nginx配置
# nginx -s reload
访问文件页面
http://ip