1、查看首页在那里
[root@python conf]# grep -i documentroot httpd.conf
# DocumentRoot: The directory out of which you will serve your
DocumentRoot "/soft/apache/htdocs"
# This should be changed to whatever you set DocumentRoot to.
# access content that does not live under the DocumentRoot.
[root@python conf]#
[root@python apache]# cd htdocs/
[root@python htdocs]# ls
index.html
2、编辑自己的主页
[root@python htdocs]# vi index.html
<head><title>wolf,hello.</title></head>
<body>
hello,wolf,my name is apache!
<a href="http://www.csdn.net/yujin2010good" targe=_parent>http://www.csdn.net/yujin2010good</a>
</body>
</html>
静态网页不需要重启
3、测试
[root@python htdocs]# curl -I http://192.168.3.40
HTTP/1.1 200 OK
Date: Thu, 03 Nov 2016 15:00:19 GMT
Server: Apache/2.2.31 (Unix)
Last-Modified: Thu, 03 Nov 2016 14:58:04 GMT
ETag: "23b6509-c4-54066c8e466a1"
Accept-Ranges: bytes
Content-Length: 196
Content-Type: text/html
[root@python htdocs]# curl http://192.168.3.40
<html>
<head><title>wolf,hello.</title></head>
<body>
hello,wolf,my name is apache!
<a href="http://www.csdn.net/yujin2010good" targe=_parent>http://www.csdn.net/yujin2010good</a>
</body>
</html>
4、apache目录结构
[root@python apache]# ll /soft/apache/
total 36
drwxr-xr-x 2 root root 4096 Nov 3 22:19 bin
drwxr-xr-x 2 root root 4096 Nov 3 22:19 build
drwxr-xr-x 2 root root 36 Nov 3 22:19 cgi-bin
drwxr-xr-x 4 root root 117 Nov 3 22:44 conf
drwxr-xr-x 3 root root 4096 Nov 3 22:19 error
drwxr-xr-x 2 root root 23 Nov 3 22:58 htdocs
drwxr-xr-x 3 root root 4096 Nov 3 22:19 icons
drwxr-xr-x 2 root root 4096 Nov 3 22:19 include
drwxr-xr-x 2 root root 95 Nov 3 22:30 logs
drwxr-xr-x 4 root root 28 Nov 3 22:19 man
drwxr-xr-x 14 root root 8192 Jul 16 2015 manual
drwxr-xr-x 2 root root 47 Nov 3 22:44 modules
[root@python apache]# cd bin
[root@python bin]# ls
ab apachectl apxs checkgid dbmmanage envvars envvars-std htcacheclean htdbm htdigest htpasswd httpd httxt2dbm logresolve rotatelogs
[root@python bin]#
ab 常用压测工具
apachectl 控制apache启动的,实际调用的httpd
apxs apache扩展编译的工具
htpasswd 为网站设置用户名密码的工具
httpd apache的控制命令程序
rotatelogs apache的日志轮询工具(按天)
[root@python conf]# ls
extra httpd.conf httpd.conf.bak index.html magic mime.types original
extra 主配置文件的子配置文件
httpd.conf 主配置文件
[root@python apache]# cd htdocs/ 默认站点目录
[root@python htdocs]# ls
index.html 默认首页文件
[root@python apache]# cd logs/
[root@python logs]# ls
access_log cgisock.24365 cgisock.24709 error_log httpd.pid
access_log 访问日志
error_log 请求日志
httpd.pid pid文件
5、修改首页
[root@python conf]# vi httpd.conf
<IfModule dir_module>
DirectoryIndex wolf.html index.html
</IfModule>
[root@python apache]# cd htdocs/
[root@python htdocs]# ls
index.html
[root@python htdocs]# mv index.html wolf.html
[root@python bin]# ./apachectl -t
Syntax OK
[root@python bin]# ./apachectl graceful (平滑重启)
[root@python bin]# curl http://192.168.3.40
<html>
<head><title>wolf,hello.</title></head>
<body>
hello,wolf,my name is apache!
<a href="http://www.csdn.net/yujin2010good" targe=_parent>http://www.csdn.net/yujin2010good</a>
</body>
</html>
[root@python conf]# grep -i documentroot httpd.conf
# DocumentRoot: The directory out of which you will serve your
DocumentRoot "/soft/apache/htdocs"
# This should be changed to whatever you set DocumentRoot to.
# access content that does not live under the DocumentRoot.
[root@python conf]#
[root@python apache]# cd htdocs/
[root@python htdocs]# ls
index.html
2、编辑自己的主页
[root@python htdocs]# vi index.html
<head><title>wolf,hello.</title></head>
<body>
hello,wolf,my name is apache!
<a href="http://www.csdn.net/yujin2010good" targe=_parent>http://www.csdn.net/yujin2010good</a>
</body>
</html>
静态网页不需要重启
3、测试
[root@python htdocs]# curl -I http://192.168.3.40
HTTP/1.1 200 OK
Date: Thu, 03 Nov 2016 15:00:19 GMT
Server: Apache/2.2.31 (Unix)
Last-Modified: Thu, 03 Nov 2016 14:58:04 GMT
ETag: "23b6509-c4-54066c8e466a1"
Accept-Ranges: bytes
Content-Length: 196
Content-Type: text/html
[root@python htdocs]# curl http://192.168.3.40
<html>
<head><title>wolf,hello.</title></head>
<body>
hello,wolf,my name is apache!
<a href="http://www.csdn.net/yujin2010good" targe=_parent>http://www.csdn.net/yujin2010good</a>
</body>
</html>
4、apache目录结构
[root@python apache]# ll /soft/apache/
total 36
drwxr-xr-x 2 root root 4096 Nov 3 22:19 bin
drwxr-xr-x 2 root root 4096 Nov 3 22:19 build
drwxr-xr-x 2 root root 36 Nov 3 22:19 cgi-bin
drwxr-xr-x 4 root root 117 Nov 3 22:44 conf
drwxr-xr-x 3 root root 4096 Nov 3 22:19 error
drwxr-xr-x 2 root root 23 Nov 3 22:58 htdocs
drwxr-xr-x 3 root root 4096 Nov 3 22:19 icons
drwxr-xr-x 2 root root 4096 Nov 3 22:19 include
drwxr-xr-x 2 root root 95 Nov 3 22:30 logs
drwxr-xr-x 4 root root 28 Nov 3 22:19 man
drwxr-xr-x 14 root root 8192 Jul 16 2015 manual
drwxr-xr-x 2 root root 47 Nov 3 22:44 modules
[root@python apache]# cd bin
[root@python bin]# ls
ab apachectl apxs checkgid dbmmanage envvars envvars-std htcacheclean htdbm htdigest htpasswd httpd httxt2dbm logresolve rotatelogs
[root@python bin]#
ab 常用压测工具
apachectl 控制apache启动的,实际调用的httpd
apxs apache扩展编译的工具
htpasswd 为网站设置用户名密码的工具
httpd apache的控制命令程序
rotatelogs apache的日志轮询工具(按天)
[root@python conf]# ls
extra httpd.conf httpd.conf.bak index.html magic mime.types original
extra 主配置文件的子配置文件
httpd.conf 主配置文件
[root@python apache]# cd htdocs/ 默认站点目录
[root@python htdocs]# ls
index.html 默认首页文件
[root@python apache]# cd logs/
[root@python logs]# ls
access_log cgisock.24365 cgisock.24709 error_log httpd.pid
access_log 访问日志
error_log 请求日志
httpd.pid pid文件
5、修改首页
[root@python conf]# vi httpd.conf
<IfModule dir_module>
DirectoryIndex wolf.html index.html
</IfModule>
[root@python apache]# cd htdocs/
[root@python htdocs]# ls
index.html
[root@python htdocs]# mv index.html wolf.html
[root@python bin]# ./apachectl -t
Syntax OK
[root@python bin]# ./apachectl graceful (平滑重启)
[root@python bin]# curl http://192.168.3.40
<html>
<head><title>wolf,hello.</title></head>
<body>
hello,wolf,my name is apache!
<a href="http://www.csdn.net/yujin2010good" targe=_parent>http://www.csdn.net/yujin2010good</a>
</body>
</html>