Apache配置网页,apache配置
Apache配置网页,apache配置
设置默认网页
在httpd.conf中找到IfModule dir_module配置,在DirectoryIndex 中添加要作为默认网页的文件。
eg: DirectoryIndex index.html index.php
修改主机域名
eg:127.0.0.1 www.php34.com
eg:ServerName www.php34.com
修改apache访问的本地路径
eg:DocumentRoot "D:\zuoye"
<Directory "D:\zuoye">
#设置当没有默认网页访问时,显示所有文件
Options Indexes
#允许 .htaccess文件设置文件夹访问权限
AllowOverride all
#设置所有文件可被访问
Require all granted
#设置默认网页
DirectoryIndex index.php
</Directory>
设置控制文件夹访问权限的文件(使用一个独立的文件来控制某个文件夹的访问权限)
eg:DirectoryIndex DbConnect.class.php
eg: AllowOverride All
设置目录别名(可以将一个站点之外的“网页/数据/内容”也呈现在当前站点中)
eg:alias /soft "D:\Apache24\htdocs"
<Directory "D:\Apache24\htdocs">
Options Indexes
AllowOverride all
Require all granted
</Directory>
多站点设置(一旦进行多站点配置,则原来httpd.conf中的默认站点配置失效)
eg: Include conf/extra/httpd-vhosts.conf
eg: NameVirtualHost *:80 *可以代表当前服务器的所有ip地址(通常只有一个)
<VirtualHost *:80>
#设置主机名
ServerName www.zm.com
#设置主机别名,即通过别名也可以访问主机
ServerAlias php34.com
#设置文件夹路径
DocumentRoot "D:\zuoye"
#对文件夹访问权限设置
<Directory "D:\zuoye">
#设置当没有默认网页访问时,显示所有文件
Options Indexes
#允许 .htaccess文件设置文件夹访问权限
AllowOverride all
#设置所有文件可被访问
Require all granted
#设置默认网页
DirectoryIndex index.php
</Directory>
</VirtualHost>
评论暂时关闭