在 Internet Information Services(IIS) 中,默认的打开页面通常是通过配置默认文档来实现的。默认文档是当用户访问网站时,如果没有指定具体的文件或目录,IIS 将显示的这个文件。例如,常见的默认文档有 index.html、index.php、default.htm 等。
要修改IIS中网站或应用的默认打开页面,你可以按照以下步骤操作:
方法1:通过IIS管理器
1、打开 IIS管理器,在左侧的连接树中,找到你想要修改的网站,双击打开 [
![图片[1]-如何修改 Internet Information Services(IIS) 服务器的默认打开页面-十一张](https://www.11zhang.com/wp-content/uploads/2026/01/3b10e49dcf20260111230747.webp)
2、你可以直接在列表中点击你想要设置为默认的文档,然后右上角点击上方的“
![图片[2]-如何修改 Internet Information Services(IIS) 服务器的默认打开页面-十一张](https://www.11zhang.com/wp-content/uploads/2026/01/f05174411520260111230747.webp)
在上面这个例子中,默认文档的优先级规则:IIS按默认文档列表顺序匹配文件,当请求 http://example.com 时,依次查找 index.html → Default.htm → Default.asp → index.htm → iisstart.htm → default.aspx,找到第一个存在的文件即停止搜索。建议将高频访问文件置于列表顶部。
2、重新启动IIS服务或重新启动你的网站应用,以使更改生效。
![图片[3]-如何修改 Internet Information Services(IIS) 服务器的默认打开页面-十一张](https://www.11zhang.com/wp-content/uploads/2026/01/59b2900aa020260111234454.webp)
方法2:通过修改web.config文件
找到你的网站根目录,打开或创建
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<directoryBrowse enabled="true" showFlags="Date, Extension" />
<defaultDocument>
<files>
<clear />
<add value="index.html" />
<add value="Default.htm" />
<add value="Default.asp" />
<add value="index.htm" />
<add value="iisstart.htm" />
<add value="default.aspx" />
</files>
</defaultDocument>
</system.webServer>
</configuration>
![图片[4]-如何修改 Internet Information Services(IIS) 服务器的默认打开页面-十一张](https://www.11zhang.com/wp-content/uploads/2026/01/723e42b98620260111231506.webp)
在上面这个例子中,index.html、Default.htm、Default.asp等文件都被设置为可能的默认文档。你可以根据需要添加或删除条目。保存 web.config 文件,然后重新启动IIS服务或重新启动你的网站应用,以使更改生效。
![图片[3]-如何修改 Internet Information Services(IIS) 服务器的默认打开页面-十一张](https://www.11zhang.com/wp-content/uploads/2026/01/59b2900aa020260111234454.webp)
注意事项
1、确保你的新默认文档文件存在于网站的根目录或任何子目录中。
2、如果你的网站使用了ASP.NET核心或其他特定框架,确保你的默认文档文件名与该框架的要求相匹配(例如,ASP.NET核心通常使用 index.html 或 default.aspx 作为默认文档)。
3、在进行任何更改后,建议清除浏览器缓存或使用无痕浏览模式来测试新的默认页面是否正确显示。
通过上述任一方法,你都可以成功修改IIS中网站的默认打开页面。
自定义页面
在使用 Internet Information Services(IIS) 服务器搭建 WebDAV 文件共享服务时,默认的页面显示效果会比较简单,如下图,主要是因为它依赖于IIS默认的 WebDAV 页面。
![图片[6]-如何修改 Internet Information Services(IIS) 服务器的默认打开页面-十一张](https://www.11zhang.com/wp-content/uploads/2026/01/ce498f48cf20260111233740.webp)
如果你想要改进或自定义这个页面的显示效果,可以直接编辑网站根目录下的默认页面文件(例如 index.html),并设计你想要的页面布局和样式。
十一张(www.11zhang.com)站长分享一个优化后的响应式设计版本,在手机和桌面设备上都能良好显示,效果如下。
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>文件服务器 - 十一张</title>
<link rel="icon" href="https://www.11zhang.com/favicon.ico">
<style>
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
body {
font-family: 'Microsoft YaHei', Arial, sans-serif;
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
min-height: 100vh;
padding: 15px;
}
.container {
max-width: 1200px;
margin: 0 auto;
background: white;
border-radius: 15px;
box-shadow: 0 10px 30px rgba(0,0,0,0.2);
overflow: hidden;
}
.header {
background: #2c3e50;
color: white;
padding: 25px 20px;
text-align: center;
}
.header h1 {
font-size: 2.2em;
margin-bottom: 10px;
}
.header p {
opacity: 0.8;
font-size: 1.1em;
}
.content {
padding: 25px 20px;
}
.directory-list {
list-style: none;
}
.directory-item {
display: flex;
align-items: center;
padding: 15px;
border-bottom: 1px solid #eee;
transition: all 0.3s ease;
}
.directory-item:hover {
background: #f8f9fa;
transform: translateX(5px);
}
.directory-icon {
width: 40px;
height: 40px;
background: #3498db;
border-radius: 8px;
display: flex;
align-items: center;
justify-content: center;
margin-right: 15px;
color: white;
font-size: 1.2em;
flex-shrink: 0;
}
.server-status {
display: flex;
justify-content: center;
gap: 2rem;
margin-top: 1.2rem;
flex-wrap: wrap;
}
.status-item {
display: flex;
align-items: center;
gap: 0.5rem;
font-size: 0.9rem;
opacity: 0.9;
}
.directory-info {
flex: 1;
min-width: 0; /* 防止内容溢出 */
}
.directory-name {
font-size: 1.2em;
color: #2c3e50;
text-decoration: none;
font-weight: bold;
display: block;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
.directory-name:hover {
color: #e74c3c;
}
.directory-date {
color: #7f8c8d;
font-size: 0.9em;
margin-top: 5px;
}
.footer {
text-align: center;
padding: 20px;
background: #ecf0f1;
color: #7f8c8d;
font-size: 0.9em;
}
/* 手机端适配样式 */
@media (max-width: 768px) {
body {
padding: 10px;
}
.header {
padding: 20px 15px;
}
.header h1 {
font-size: 1.8em;
}
.header p {
font-size: 1em;
}
.content {
padding: 20px 15px;
}
.directory-item {
padding: 12px 10px;
}
.directory-icon {
width: 35px;
height: 35px;
font-size: 1em;
margin-right: 12px;
}
.directory-name {
font-size: 1.1em;
}
.directory-date {
font-size: 0.85em;
}
}
@media (max-width: 480px) {
.header h1 {
font-size: 1.6em;
}
.header p {
font-size: 0.95em;
}
.directory-item {
flex-direction: column;
align-items: flex-start;
padding: 15px 10px;
}
.directory-icon {
margin-right: 0;
margin-bottom: 10px;
}
.directory-info {
width: 100%;
}
.directory-name {
white-space: normal;
overflow: visible;
text-overflow: unset;
}
}
</style>
</head>
<body>
<div class="container">
<div class="header">
<h1>📁 文件服务器</h1>
<p>欢迎访问内部文件共享平台</p>
</div>
<div class="content">
<ul class="directory-list">
<li class="directory-item">
<div class="directory-icon">🔗</div>
<div class="directory-info">
<a href="/dog/" class="directory-name">常用网址</a>
<div class="directory-date">创建时间:2023年01月07日</div>
</div>
</li>
<li class="directory-item">
<div class="directory-icon">💾</div>
<div class="directory-info">
<a href="/%E8%BD%AF%E4%BB%B6/" class="directory-name">软件下载</a>
<div class="directory-date">创建时间:2023年01月07日</div>
</div>
</li>
<li class="directory-item">
<div class="directory-icon">📊</div>
<div class="directory-info">
<a href="/scan/" class="directory-name">扫描文件</a>
<div class="directory-date">创建时间:2023年01月07日</div>
</div>
</li>
<!-- 这是注释内容 -->
<li class="directory-item">
<div class="directory-icon">📁</div>
<div class="directory-info">
<a href="/tmp/" class="directory-name">tmp</a>
<div class="directory-date">创建时间:2026年01月09日</div>
</div>
</li>
</ul>
</div>
<div class="footer">
<div class="server-status">
<div class="status-item">🟢服务器IP地址:10.55.0.55</div>
<div class="status-item">⏰当前时间:<span id="currentTime"></span></div>
<div class="status-item">🏃🏻♂️➡️<a href="https://www.11zhang.com" target="_blank">十一张</a></div>
</div>
</div>
</div>
<script>
// 显示当前时间
function updateTime() {
const now = new Date();
document.getElementById('currentTime').textContent =
now.toLocaleString('zh-CN');
}
setInterval(updateTime, 1000);
updateTime();
// 移动端触摸优化
document.querySelectorAll('.directory-item').forEach(item => {
item.addEventListener('touchstart', function() {
this.style.backgroundColor = '#f0f5ff';
});
item.addEventListener('touchend', function() {
setTimeout(() => {
this.style.backgroundColor = '';
}, 150);
});
});
</script>
</body>
</html>
![图片[7]-如何修改 Internet Information Services(IIS) 服务器的默认打开页面-十一张](https://www.11zhang.com/wp-content/uploads/2026/01/f31ed9640420260111233741.webp)



















暂无评论内容