如何解决nginx上的"Index of"问题



ON nginx 我配置了这个角色:

  On server file:
    location ~ .php$ {
    root /var/www/public;
    fastcgi_split_path_info ^(.+.php)(.*)$;
    fastcgi_pass   127.0.0.1:9000;
    fastcgi_index  index.php;
    #fastcgi_param  SCRIPT_FILENAME  /var/www/public$fastcgi_script_name;
    fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
    include fastcgi_params;
    }
  # On Domain file
  location /support {
  try_files $uri $uri/ /index.php;
  autoindex on;
  autoindex_exact_size off;
  }
  #for admin panel 
  location ^~ /support/admin {
  try_files $uri $uri/ /admin/index.php;
  autoindex on;
  autoindex_exact_size off;
  }

当我添加自动索引时,我解决了 403 错误问题; 行,但是当我单击我的域时,我看到"支持索引"消息当我想单击索引.html文件时,此文件不显示,取而代之的是下载完成。如何解决此问题以及共享代码中的问题是什么

试试这个

location /support { default_type "text/html"; types { application/octet-stream html; } … }

最新更新