This is my local php server
<?php
$request_uri = '.'.urldecode($_SERVER['REQUEST_URI']);
if( is_dir($request_uri) ){
$dirname = preg_replace('/\/{2}/', '/', $request_uri.'/');
$files_arr = array_filter(scandir($dirname), function($file_name){
return false == (bool)preg_match('/^\.+/', $file_name);
});
$browser_path = preg_replace('/^\./', '', $dirname);
printf('<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0">
</head>
<body>
%s
</body>
</html>',
implode(
preg_replace('/^(.*)$/', '<a href="'.$browser_path.'${1}">${1}</a>', $files_arr),
'<br/>'
)
);
}else{
header('Content-Type: '.mime_content_type($request_uri));
echo file_get_contents($request_uri);
}