百度百科介绍

httpd是Apache超文本传输协议(HTTP)服务器的主程序。被设计为一个独立运行的后台进程,它会建立一个处理请求的子进程或线程的池。

简单来说httpd可以发布网页、文件服务器等。

端口port配置

#
# Listen: Allows you to bind Apache to specific IP addresses and/or
# ports, instead of the default. See also the <VirtualHost>
# directive.
#
# 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

监听端口号默认是80,可以根据自己情况修改。注意如果是云服务器,需要开放对应端口号。

主目录配置

#
# 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 "/var/www/html"

可以看到,默认目录是/var/www/html,上一篇文章我们就是在此目录下编写index.html进行测试,次数可以改成其他目录。

此目录还可以放置文件,作为文件服务器使用。