DirectoryIndex出力のカスタマイズ

  • 0
    いいね
  • 0
    コメント

    apache

    httpd.conf

    /etc/apache2/apache2.conf
      <Directory /var/www/html/>
        Options Indexes FollowSymLinks
        AllowOverride None
        Require all granted
        #
    +   IndexOptions +FoldersFirst
    +   IndexOptions +NameWidth=*
      </Directory>
    
    • フォルダを最初に表示
    • フォルダ名が長くても表示

    mod.png

    nginx

    /etc/nginx/sites-available/default

      server {
        listen 80 default_server;
        root /var/www/html/;
        index index.html index.htm index.nginx-debian.html;
        server_name _;
        location / {
    +       autoindex on;
    +       autoindex_localtime on;
            try_files $uri $uri/ =404;
        }
        location ~ \.php$ {
            root           /usr/share/nginx/html;
            fastcgi_pass   127.0.0.1:9000;
            fastcgi_index  index.php;
            fastcgi_param  SCRIPT_FILENAME  /usr/share/nginx/html$fastcgi_script_name;
            include        fastcgi_params;
        }
      }
    
    • DirectoryIndex を有効
    • サーバーのタイムゾーンを使用

    nginx.png