Apache中设置默认首页的方法
2023-05-19 21:35
APACHE
127
0
0
0
标题录入
封面图
Apache中设置默认首页的方法 在你安装后的Apache目录下,有一个conf目录,在这个目录里,有一个"httpd.conf"文件.我们要做的,就是修改这个文件. 比如 /etc/httpd/conf/httpd.conf 在这个文件里,凡是以"#"开头的每一行,都是无效的,如果你想让你的设置起作用,就要把行首的"#"去掉. 找到 DirectoryIndex 这段 /etc/httpd/conf/httpd.conf中的<IfModule dir_module>,其默认内容如下: ``` <IfModule dir_module> DirectoryIndex index.php index.html <IfModule> ``` 把它改成DirectoryIndex index.php index.Html index.html 这样,你的网站目录的默认首页是 index.php, 如果没有index.php系统会自动寻找index.html、html做为默认首页了。 注意事项:index.php index.Html之间要有一个空格 另外你还可以操作一下其它的: 1,设置网站根目录 找到DocumentRoot 这段.把他设成你网站的根目录,比如 DocumentRoot "/www/test" DocumentRoot "/www/test" 2,设置权限 ``` <Directory "/www/test"> Options -Indexes FollowSymLinks AllowOverride None Order allow,deny Allow from all DirectoryIndex index.php index.html </Directory> ``` 注意:这两部当中涉及到的两个路径DocumentRooth和Director必须保持一致,否则会报没有权限的错误。
下一篇:
apache中设置只允许本地和另一IP访问!
标题录入,一次不能超过6条
为什么赌博的人都相信自己会赢?
T:0.011561s,M:243.53 KB
返回顶部
留言
留言
评论