nginx开启目录浏览

使用nginx作为下载站点,开启目录浏览的功能

在/etc/nginx/sites-enabled/default中添加:

autoindex on ;

autoindex_exact_size off;

autoindex_localtime on;

说明:

第一个为目录浏览功能开始

第二个为不精确计算文件大小

第三个为取时间为服务器本地的时间

删除location相关的内容

修改完成重启nginx服务

时间: 2024-07-30 12:53:34

nginx开启目录浏览的相关文章

nginx开启目录浏览,解决中文乱码问题

nginx开启目录浏览,解决中文乱码问题 方法如下: server { listen 80; #listen [::]:80; server_name gongzi.liwenhui.xin gz.liwenhui.xin; index index.html index.htm index.php default.html default.htm default.php; root /www/gongzi.liwenhui.xin/; include other.conf; #error_pag

Nginx 开启目录浏览功能配置

在server节点下添加 1 server { 2 listen 8007; 3 server_name default; 4 #index index.php; 5 # 目录浏览功能 6 autoindex on; 7 # 显示文件大小统计 8 autoindex_exact_size off; 9 10 root /mnt/hgfs/dev; 11 12 location ~ \.php(.*)$ { 13 add_header 'Access-Control-Allow-Origin' '

Nginx 和 Apache 开启目录浏览功能

1.Nginx 在相应项目的 Server 段中的 location 段中,添加 autoindex on.例如: server { listen 80; server_name www.dee.practise.com; location /{ root html/practise; #index index.php; autoindex on; } location ~ \.php$ { #root html; root html/practise; #fastcgi_pass 127.0.

Nginx打开目录浏览功能(autoindex)

Nginx默认是不允许列出整个目录的.如需此功能,打开nginx.conf文件或你要启用目录浏览虚拟主机的配置文件,在server或location 段里添加上autoindex on;来启用目录流量,下面会分情况进行说明. 另外Nginx的目录流量有两个比较有用的参数,可以根据自己的需求添加: autoindex_exact_size off;默认为on,显示出文件的确切大小,单位是bytes.改为off后,显示出文件的大概大小,单位是kB或者MB或者GB autoindex_localtim

Nginx设置目录浏览并配置验证

Nginx默认是不允许进行列目录的,如果需要使某个目录可以进行浏览,可如下设置:如: 让/var/www/soft 这个目录在浏览器中完成列出. 一.设置目录浏览1.打开/usr/local/nginx/conf/nginx.conf,找到WebServer配置处,加入以下内容: location /soft/ { root /var/www/; 此处为soft的上一级目录 autoindex on; autoindex_exact_size off; autoindex_localtime o

配置 Nginx 的目录浏览功能

Nginx 默认是不允许列出整个目录的,需要配置 Nginx 自带的 ngx_http_autoindex_module 模块实现目录浏览功能 . location / { alias /opt/files/; autoindex on; autoindex_exact_size off; autoindex_localtime on; } autoindex_exact_size off;默认为on,显示出文件的确切大小,单位是bytes.改为off后,显示出文件的大概大小,单位是kB或者MB

fedora 开启 apache 并 开启目录浏览模式

在内网中 暂时需要一台 文件 服务器,所以准备安装一台 http服务器并开启目录访问权限.这次使用 apache 在 fedora 28 机器上: 因为 fedora 28 已经包含 httpd 软件,使用 systemctl start httpd 就能进行启动. 启动时 默认开启 目录访问权限,但是首次访问网站根目录的时候,会显示test page. 进入如下文件夹: [[email protected]65-15 conf.d]# pwd /etc/httpd/conf.d [[email

nginx localhost 配置,开启目录浏览

以前使用Apache,有时候访问 localhost ,居然提示403 access die ,但有时候过几天又可以(没有修改过任何配置的情况下),很诡异,出现这样情况的时候不管是怎么修改配置都是提示403无权限!几率很低但一直无法解决. 换 nginx 后就没有再出现这样问题,autoindex 用的很爽. 配置文件 localhost.conf : 其中对 http://localhost/phpmyadmin/ alias别名到phpmyadmin! server { listen 80;

nginx打开目录浏览功能

nginx默认是不允许列出整个目录的.如需此功能,        打开nginx.conf文件,在location server 或 http段中加入        autoindex on; 另外两个参数最好也加上去:       autoindex_exact_size off;默认为on,显示出文件的确切大小,单位是bytes.改为off后,显示出文件的大概大小,单位是kB或者MB或者GB        autoindex_localtime on; 默认为off,显示的文件时间为GMT时