Nginx开启目录访问功能

永远的零 2024-06-28 PM 535℃ 0条

Nginx目录访问开启的三种场景

nginx.webp

configuration file /etc/nginx/conf.d/server81.conf:

server {
  listen       81;
  server_name  localhost;
  location / {
   root /;
   autoindex on;
   autoindex_localtime on;
  }
}



configuration file /etc/nginx/conf.d/server82.conf:

server {
  listen       82;
  server_name  localhost;
  location /download {
   root /usr/share/nginx/;
   autoindex_exact_size off;
   autoindex on;
   autoindex_localtime on;
   }
}


configuration file /etc/nginx/conf.d/server83.conf:

server {
  listen       83;
  server_name  localhost;
  location /download {
      alias /home/nginx/;
      autoindex_exact_size off;
      autoindex on;
      autoindex_localtime on;
   }
}

人要么永不做梦,要么梦得有趣;人也必须学会清醒:要么永不清醒,要么清醒得有趣。

评论啦~