Apache 目錄列表

2022-08-24 10:33:08 字數 820 閱讀 5946

// 1. 如何得到 wwwdir 目錄列表中的檔名和目錄名

// fs.readdir

// 2. 如何將得到的檔名和目錄名替換到 template.html 中

// 2.1 在 template.html 中需要替換的位置預留乙個特殊的標記(就像以前使用模板引擎的標記一樣)

// 2.2 根據 files 生成需要的 html 內容

// 只要你做了這兩件事兒,那這個問題就解決了

fs.readdir(wwwdir, function (err, files)

// 2.1 生成需要替換的內容

var content = ''

files.foreach(function (item) 來引用變數

content += `

2017/11/2 上午10:32:47`})

// 2.3 替換

data = data.tostring()

data = data.replace('^_^', content)

// 3. 傳送解析替換過後的響應資料

res.end(data)

})})

})server.listen(3000, function () )

apache禁止訪問目錄列表

apache禁止訪問目錄列表對於開發人員來說還是蠻實用的,可以迅速查詢根目錄下的所有專案,但如果乙個掛在網際網路上的伺服器為了提高安全性就必須禁止訪問目錄列表。找到apache 的 httpd.conf 配置檔案將 xml html options indexes followsymlinks 改為...

禁止 Apache 顯示目錄列表

如何禁止 apache 顯示目錄列表呢?要禁止 apache 顯示目錄結構列表,只需將option中的indexes去掉即可。比如我們看看乙個目錄的目錄配置 options indexes followsymlinks allowoverride none order allow,deny allo...

Apache目錄別名

1.開啟主配置檔案 usr local apache2 conf httpd.conf,去掉注釋 2.編輯 httpd autoindex.conf 新增內容 alias test data www options indexes multiviews allowoverride none requ...