apache 服务器配置
2018-04-10 19:22
211 查看
Apache 的conf 的文件夹中httpd.conf 就是Apache 的配置文件,根目录是htdocs文件夹
1.Apache 默认 监听端口号
Listen 命令可以修改默认 监听端口号:
httpd.conf 中
# Change this to Listen on specific IP addresses as shown below to
# prevent Apache from glomming onto all bound IP addresses.
#
#Listen 12.34.56.78:80
Listen 80
在这里我们就可以改端口号了,需要注意的是,Apache服务器需要重启,才能生效。
2.修改网站根目录
需要修改DocumentRoot 和DocumentRoot
下的子命令<Directory >
httpd.conf 中
#
# DocumentRoot: The directory out of which you will serve your
# documents. By default, all requests are taken from this directory, but
# symbolic links and aliases may be used to point to other locations.
#
DocumentRoot "E:/woderuanjian/Apache Software Foundation/Apache2.4/htdocs"
<Directory "E:/woderuanjian/Apache Software Foundation/Apache2.4/htdocs">
#
#
Options Indexes FollowSymLinks
#
#
AllowOverride None
#
Require all granted
</Directory>
修改时,我们把DocumentRoot,和<Directory
> 后的地址文件夹 都修改成同一个“F:/web”,这样Apache 根目录就就是F:/web了,重启Apache
在浏览器中输入127.0.0.1,就会显示F:/web下的文件
3.更改网站默认加载文件
httpd.conf 中
DirectoryIndex
#
# DirectoryIndex: sets the file that Apache will serve if a directory
# is requested.
#
<IfModule dir_module>
DirectoryIndex index.html
</IfModule>
红色这句话 说明,我们在浏览器中输入127.0.0.1是,会自动加载根目录下的 index.html 文件,如果不存在 index.html 文件的话, 就会显示 跟目录下的所有文件的名字,大家可以自行试一下,如果我们需要增加默认加载文件,就直接在 DirectoryIndex index.html 这里进行输入空格后添加到后面即可。如下:
DirectoryIndex index.html index.php welcome.jsp
并按照先后顺序依次查找。
1.Apache 默认 监听端口号
Listen 命令可以修改默认 监听端口号:
httpd.conf 中
# Change this to Listen on specific IP addresses as shown below to
# prevent Apache from glomming onto all bound IP addresses.
#
#Listen 12.34.56.78:80
Listen 80
在这里我们就可以改端口号了,需要注意的是,Apache服务器需要重启,才能生效。
2.修改网站根目录
需要修改DocumentRoot 和DocumentRoot
下的子命令<Directory >
httpd.conf 中
#
# DocumentRoot: The directory out of which you will serve your
# documents. By default, all requests are taken from this directory, but
# symbolic links and aliases may be used to point to other locations.
#
DocumentRoot "E:/woderuanjian/Apache Software Foundation/Apache2.4/htdocs"
<Directory "E:/woderuanjian/Apache Software Foundation/Apache2.4/htdocs">
#
#
Options Indexes FollowSymLinks
#
#
AllowOverride None
#
Require all granted
</Directory>
修改时,我们把DocumentRoot,和<Directory
> 后的地址文件夹 都修改成同一个“F:/web”,这样Apache 根目录就就是F:/web了,重启Apache
在浏览器中输入127.0.0.1,就会显示F:/web下的文件
3.更改网站默认加载文件
httpd.conf 中
DirectoryIndex
#
# DirectoryIndex: sets the file that Apache will serve if a directory
# is requested.
#
<IfModule dir_module>
DirectoryIndex index.html
</IfModule>
红色这句话 说明,我们在浏览器中输入127.0.0.1是,会自动加载根目录下的 index.html 文件,如果不存在 index.html 文件的话, 就会显示 跟目录下的所有文件的名字,大家可以自行试一下,如果我们需要增加默认加载文件,就直接在 DirectoryIndex index.html 这里进行输入空格后添加到后面即可。如下:
DirectoryIndex index.html index.php welcome.jsp
并按照先后顺序依次查找。
相关文章推荐
- httpd-apache服务器配置
- RHCE课程-RH253Linux服务器架设笔记五-APACHE服务器配置(3)
- Web学习之——02Apache的基本配置(全局配置、主服务器配置)
- RHCE课程-RH253Linux服务器架设笔记五-APACHE服务器配置(4)
- ASP.net + Apache服务器配置(局域网内)
- 高性能apache服务器配置大并发教程MPM模块配置
- (RHCE)10 Apache服务器配置
- Apache服务器配置反向代理实现负载均衡和双机热备
- Apache服务器配置默认首页文件名和网站路径
- centos7 下Apache服务器配置
- laravel apache 服务器配置
- Linux+Apache服务器配置详解
- Mac版PhpStorm之XAMPP整合apache服务器配置
- linux下Apache服务器配置虚拟域名
- http apache服务器配置(域名+转发端口)
- linux下Apache服务器配置虚拟域名
- 基于Apache的Svn服务器配置
- PHP 服务器配置(使用Apache及IIS两种方法)
- Apache服务器配置WEBDAV详解
- Windows下的PHP5与Apache服务器配置