2016-08-17 7 views

答えて

0

私は良い解決策を見つけることができませんでしたが、これが私のやり方です。 私は必要なファイルのみを表示するようにindex.phpページを作成しました。それは完璧な解決策ではないかもしれないが、何とかそれをやらなければならなかった。 私はまた、Apacheのconfディレクトリインデックスを変更する必要がありました。

エイリアス/塩 "の/ var /キャッシュ/塩/マスター/手下"

<Directory "/var/cache/salt/master/minions/"> 
    Options Indexes FollowSymLinks 
    Require all granted 
    DirectoryIndex index.php 
</Directory> 

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN"> 
<html> 
<head> 
    <title>Index of /salt</title> 
</head> 
<body> 
<?php 

function get_string_between($string, $start, $end){ 
    $string = ' ' . $string; 
    $ini = strpos($string, $start); 
    if ($ini == 0) return ''; 
    $ini += strlen($start); 
    $len = strpos($string, $end, $ini) - $ini; 
    return substr($string, $ini, $len); 
} 

$dir = new RecursiveDirectoryIterator(__DIR__); 
$flat = new RecursiveIteratorIterator($dir); 
$files = new RegexIterator($flat, '/\.pem$/i'); 
$relpath = array(); 
foreach($files as $file) { 
    $parsed = get_string_between($file, '/master/minions/', 'ssl_cert.pem'); 
    array_push($relpath,$parsed); 
} 
?> 
<h1>Index of /salt</h1> 
    <table> 
    <tr><th valign="top"><img src="/icons/blank.gif" alt="[ICO]"></th><th><a href="?C=N;O=D">Name</a></th><th><a href="?C=D;O=A">Description</a></th></tr> 
    <tr><th colspan="5"><hr></th></tr> 
<?php 
foreach ($relpath as &$value) { 
    echo "<tr><td valign='top'><img src='/icons/folder.gif' alt='[DIR]'></td><td><a href='$value'>$value</a></td><td align='right'> - </td><td>&nbsp;</td></tr>"; 
} 
?> 
    <tr><th colspan="5"><hr></th></tr> 
</table> 
<address>Apache/2.4.7 (Ubuntu) Server at 10.102.28.170 Port 90</address> 
</body></html> 
:それは誰かを助けている場合ここで

コードです
関連する問題